+#endif
+#endif
+}
+
+void SaveSnapshotSingle(ListNode *snapshot_buffers)
+{
+ if (snapshot_single)
+ FreeSnapshotSingle();
+
+ snapshot_single = snapshot_buffers;
+}
+
+void SaveSnapshotToList(ListNode *snapshot_buffers)
+{
+ if (snapshot_current != snapshot_list)
+ FreeSnapshotList_UpToNode(snapshot_current);
+
+#if DEBUG_SNAPSHOTS
+ printf("::: SaveSnapshotToList() [%d] [%d snapshots, %d buffers, %d bytes]\n",
+ next_snapshot_key, num_snapshots,
+ num_snapshot_buffers, num_snapshot_bytes);
+#endif
+
+ addNodeToList(&snapshot_list, i_to_a(next_snapshot_key),
+ snapshot_buffers);
+
+ snapshot_current = snapshot_list;
+
+ num_snapshots++;
+ next_snapshot_key++;
+
+ if (num_snapshot_bytes > MAX_SNAPSHOT_BYTES)
+ ReduceSnapshotList();
+}
+
+boolean LoadSnapshotSingle()
+{
+ if (snapshot_single)
+ {
+ LoadSnapshotBuffers(snapshot_single);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+boolean LoadSnapshotFromList_Older(int steps)
+{
+ if (snapshot_current && snapshot_current->next)
+ {
+ while (snapshot_current->next && steps--)
+ snapshot_current = snapshot_current->next;
+
+ LoadSnapshotBuffers(snapshot_current->content);
+
+#if DEBUG_SNAPSHOTS
+ printf("::: LoadSnapshotFromList_Older() [%s]\n", snapshot_current->key);
+#endif
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+boolean LoadSnapshotFromList_Newer(int steps)
+{
+ if (snapshot_current && snapshot_current->prev)
+ {
+ while (snapshot_current->prev && steps--)
+ snapshot_current = snapshot_current->prev;
+
+ LoadSnapshotBuffers(snapshot_current->content);
+
+#if DEBUG_SNAPSHOTS
+ printf("::: LoadSnapshotFromList_Newer() [%s]\n", snapshot_current->key);
+#endif
+
+ return TRUE;
+ }
+
+ return FALSE;