]> git.pond.sub.org Git - empserver/commitdiff
(xundump1, xundump2): Move call of xutrailer() from xundump1() to its
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 5 Aug 2007 17:19:52 +0000 (17:19 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 5 Aug 2007 17:19:52 +0000 (17:19 +0000)
caller xundump2().  Make xundump1() return number of records read for
that.

src/lib/common/xundump.c

index ab408b4c4d5f6d8856bdf43b695db50db0befc16..7fa94fdf3a22e36f9c47e6f242d95114f9ee813a 100644 (file)
@@ -784,13 +784,15 @@ xundump(FILE *fp, char *file, int *plno, int expected_table)
 static int
 xundump2(FILE *fp, int type, struct castr *ca)
 {
-    int i;
+    int recs, i;
 
     is_partial = 0;
     for (;;) {
        if (xuheader1(fp, ca) < 0)
            return -1;
-       if (xundump1(fp) < 0)
+       if ((recs = xundump1(fp)) < 0)
+           return -1;
+       if (xutrailer(fp, recs) < 0)
            return -1;
        if (!ellipsis)
            return 0;
@@ -842,8 +844,5 @@ xundump1(FILE *fp)
        memset(ep->cache + ep->size * n, 0, ep->size);
     }
 
-    if (xutrailer(fp, row) < 0)
-       return -1;
-
-    return 0;
+    return row;
 }