]> git.pond.sub.org Git - empserver/commitdiff
Fix how configuration tables and empdump treat omitted entries
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 22 May 2011 07:14:11 +0000 (09:14 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 25 Jun 2011 14:51:56 +0000 (16:51 +0200)
Change xundump to blank out omitted rows.  Before, they were left
alone.  Impact:

* No change for reading builtin tables.

* Reading custom tables now replaces the builtin tables instead of
  sort-of-merging them.  Wasn't a real merge, because it dropped
  builtin entries after the last custom entry, except for
  non-truncatable tables item, sect-chr and infrastructure.

* empdump -i now replaces the old state instead of sort-of-merging the
  dump into the old state.  Wasn't a real merge, because it dropped
  old state entries after the last entry in the dump, except for the
  fixed-size tables sect, nat, realm and game.

src/lib/common/xundump.c

index d7f7930d072e26b422c5dada651b6053dd3cf3eb..1f3dd404bdf87ad214afa2fa3ce2a1fa780a17a4 100644 (file)
@@ -177,6 +177,7 @@ tbl_next_obj(void)
 
 /*
  * Omit ID1..ID2-1.
+ * Reset the omitted objects to default state.
  */
 static void
 omit_ids(int id1, int id2)
@@ -189,8 +190,10 @@ omit_ids(int id1, int id2)
     idgap = realloc(idgap, (id2 + 1) * sizeof(*idgap));
     for (i = idgap_max; i < id1; i++)
        idgap[i] = 0;
-    for (i = id1; i < id2; i++)
+    for (i = id1; i < id2; i++) {
+       ef_blank(cur_type, i, ef_ptr(cur_type, i));
        idgap[i] = 1;
+    }
     idgap[id2] = 0;
     idgap_max = id2;
 }
@@ -214,6 +217,7 @@ expected_id(int id1, int id2)
  * Get the next object, it has record index ID.
  * Store it in cur_obj, and set cur_id and cur_obj_is_blank accordingly.
  * Ensure we're omitting the same objects as the previous parts.
+ * Reset any omitted objects to default state.
  * Return 0 on success, -1 on failure.
  */
 static int
@@ -253,6 +257,7 @@ tbl_skip_to_obj(int id)
  * Finish table part.
  * If the table has variable length, truncate it.
  * Else ensure we're omitting the same objects as the previous parts.
+ * Reset any omitted objects to default state.
  * Return 0 on success, -1 on failure.
  */
 static int