Просмотр исходного кода

dpkg: Change write_filelist_except() to take a mask intead of a bool

This generalizes the function to exclude any desired file namenode
flag and not just fnnf_elide_other_lists. It also gets rid of the
bool variable which is generally a bad interface to change function
behaviour when it should really be a named flag or a mask.
Guillem Jover лет назад: 15
Родитель
Сommit
0582645c28
3 измененных файлов с 7 добавлено и 6 удалено
  1. 4 4
      src/filesdb.c
  2. 1 1
      src/filesdb.h
  3. 2 1
      src/processarc.c

+ 4 - 4
src/filesdb.c

@@ -492,12 +492,12 @@ void ensure_allinstfiles_available_quiet(void) {
 }
 
 /*
- * If leaveout is nonzero, will not write any file whose filenamenode
- * has the fnnf_elide_other_lists flag set.
+ * If mask is nonzero, will not write any file whose filenamenode
+ * has any flag bits set in mask.
  */
 void
 write_filelist_except(struct pkginfo *pkg, struct fileinlist *list,
-                      bool leaveout)
+                      enum fnnflags mask)
 {
   static struct varbuf newvb;
   const char *listfile;
@@ -515,7 +515,7 @@ write_filelist_except(struct pkginfo *pkg, struct fileinlist *list,
     ohshite(_("unable to create updated files list file for package %s"),pkg->name);
   push_cleanup(cu_closestream, ehflag_bombout, NULL, 0, 1, (void *)file);
   while (list) {
-    if (!(leaveout && (list->namenode->flags & fnnf_elide_other_lists))) {
+    if (!(mask && (list->namenode->flags & mask))) {
       fputs(list->namenode->name,file);
       putc('\n',file);
     }

+ 1 - 1
src/filesdb.h

@@ -164,7 +164,7 @@ void ensure_allinstfiles_available_quiet(void);
 void note_must_reread_files_inpackage(struct pkginfo *pkg);
 struct filenamenode *findnamenode(const char *filename, enum fnnflags flags);
 void write_filelist_except(struct pkginfo *pkg, struct fileinlist *list,
-                           bool leaveout);
+                           enum fnnflags mask);
 
 struct reversefilelistiter { struct fileinlist *todo; };
 

+ 2 - 1
src/processarc.c

@@ -1264,7 +1264,8 @@ void process_archive(const char *filename) {
       /* Found one. We delete remove the list entry for this file,
        * (and any others in the same package) and then mark the package
        * as requiring a reread. */
-      write_filelist_except(otherpkg, otherpkg->clientdata->files, 1);
+      write_filelist_except(otherpkg, otherpkg->clientdata->files,
+                            fnnf_elide_other_lists);
       ensure_package_clientdata(otherpkg);
       debug(dbg_veryverbose, "process_archive overwrote from %s", otherpkg->name);
     }