]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/conf-journal.c
tableprinter: header option now parsed by xtypes
[libucw.git] / ucw / conf-journal.c
index 6412328acaf9017f32f545167e747d52d463554e..7d3ccdce1e7f83347ebe73d8db4de0681cdb3dfa 100644 (file)
@@ -24,7 +24,7 @@ struct old_pools {
 struct cf_journal_item {
   struct cf_journal_item *prev;
   byte *ptr;
-  uns len;
+  uint len;
   byte copy[0];
 };
 
@@ -33,14 +33,14 @@ cf_set_journalling(int enable)
 {
   struct cf_context *cc = cf_get_context();
   ASSERT(!cc->journal);
-  cc->need_journal = enable;
+  cc->enable_journal = enable;
 }
 
 void
-cf_journal_block(void *ptr, uns len)
+cf_journal_block(void *ptr, uint len)
 {
   struct cf_context *cc = cf_get_context();
-  if (!cc->need_journal)
+  if (!cc->enable_journal)
     return;
   struct cf_journal_item *ji = cf_malloc(sizeof(struct cf_journal_item) + len);
   ji->prev = cc->journal;
@@ -60,7 +60,7 @@ cf_journal_swap(void)
   {
     prev = curr->prev;
     curr->prev = next;
-    for (uns i=0; i<curr->len; i++)
+    for (uint i=0; i<curr->len; i++)
     {
       byte x = curr->copy[i];
       curr->copy[i] = curr->ptr[i];
@@ -71,7 +71,7 @@ cf_journal_swap(void)
 }
 
 struct cf_journal_item *
-cf_journal_new_transaction(uns new_pool)
+cf_journal_new_transaction(uint new_pool)
 {
   struct cf_context *cc = cf_get_context();
   if (new_pool)
@@ -82,7 +82,7 @@ cf_journal_new_transaction(uns new_pool)
 }
 
 void
-cf_journal_commit_transaction(uns new_pool, struct cf_journal_item *oldj)
+cf_journal_commit_transaction(uint new_pool, struct cf_journal_item *oldj)
 {
   struct cf_context *cc = cf_get_context();
   if (new_pool)
@@ -102,11 +102,11 @@ cf_journal_commit_transaction(uns new_pool, struct cf_journal_item *oldj)
 }
 
 void
-cf_journal_rollback_transaction(uns new_pool, struct cf_journal_item *oldj)
+cf_journal_rollback_transaction(uint new_pool, struct cf_journal_item *oldj)
 {
   struct cf_context *cc = cf_get_context();
-  if (!cc->need_journal)
-    die("Cannot rollback the configuration, because the journal is disabled.");
+  if (!cc->enable_journal)
+    return;
   cf_journal_swap();
   cc->journal = oldj;
   if (new_pool)
@@ -126,5 +126,3 @@ cf_journal_delete(void)
     mp_delete(p->pool);
   }
 }
-
-/* TODO: more space efficient journal */