The following commit has been merged in the master branch:
commit ef18ac88b029b0dba4272d3b2daa9130146d2697
Author: Guillem Jover <guil...@debian.org>
Date:   Tue Aug 2 04:50:09 2011 +0200

    libdpkg: Detangle fieldinfos from struct field_state
    
    Define the fieldencountered array in the stack, and switch the array
    in struct field_state to be a pointer to that array. This way we do not
    pull the fieldinfos symbol (specific to the parsedb() function) to the
    now generic struct field_state.

diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index 7c6e7f0..491d9dd 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -99,7 +99,7 @@ struct field_state {
   struct varbuf value;
   int fieldlen;
   int valuelen;
-  int fieldencountered[array_count(fieldinfos)];
+  int *fieldencountered;
 };
 
 /**
@@ -450,6 +450,7 @@ int parsedb(const char *filename, enum parsedbflags flags,
   struct pkginfo tmp_pkg;
   struct pkginfo *new_pkg, *db_pkg;
   struct pkgbin *new_pkgbin, *db_pkgbin;
+  int fieldencountered[array_count(fieldinfos)];
   int pdone;
   char *data;
   struct stat st;
@@ -461,6 +462,7 @@ int parsedb(const char *filename, enum parsedbflags flags,
   ps.lno = 0;
 
   memset(&fs, 0, sizeof(fs));
+  fs.fieldencountered = fieldencountered;
 
   new_pkg = &tmp_pkg;
   if (flags & pdb_recordavailable)
@@ -500,7 +502,7 @@ int parsedb(const char *filename, enum parsedbflags flags,
 
   /* Loop per package. */
   for (;;) {
-    memset(fs.fieldencountered, 0, sizeof(fs.fieldencountered));
+    memset(fieldencountered, 0, sizeof(fieldencountered));
     pkg_blank(new_pkg);
 
     if (!parse_stanza(&ps, &fs, pkg_parse_field, new_pkg, new_pkgbin))

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to