瀏覽代碼

Move duplicate ensure_package_clientdata functions to src/filesdb.c

Guillem Jover 18 年之前
父節點
當前提交
8003f9dd11
共有 6 個文件被更改,包括 21 次插入17 次删除
  1. 8 0
      ChangeLog
  2. 11 0
      src/filesdb.c
  3. 2 0
      src/filesdb.h
  4. 0 8
      src/help.c
  5. 0 1
      src/main.h
  6. 0 8
      src/query.c

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+2008-03-25  Guillem Jover  <guillem@debian.org>
+
+	* src/main.h (ensure_package_clientdata): Move prototype to ...
+	* src/filesdb.h: ... here.
+	* src/help.c (ensure_package_clientdata): Move function to ...
+	* src/filesdb.c: ... here.
+	* src/query.c: Remove duplicate function.
+
 2008-03-25  Guillem Jover  <guillem@debian.org>
 
 	* lib/dpkg-db.h (unlockdatabase): Change prototype to not take any

+ 11 - 0
src/filesdb.c

@@ -46,6 +46,17 @@ static struct diversion *diversions = NULL;
 static FILE *diversionsfile = NULL;
 static FILE *statoverridefile = NULL;
 
+void
+ensure_package_clientdata(struct pkginfo *pkg)
+{
+  if (pkg->clientdata)
+    return;
+  pkg->clientdata = nfmalloc(sizeof(struct perpackagestate));
+  pkg->clientdata->istobe = itb_normal;
+  pkg->clientdata->fileslistvalid = 0;
+  pkg->clientdata->files = NULL;
+}
+
 void note_must_reread_files_inpackage(struct pkginfo *pkg) {
   allpackagesdone= 0;
   ensure_package_clientdata(pkg);

+ 2 - 0
src/filesdb.h

@@ -131,6 +131,8 @@ struct fileiterator *iterfilestart(void);
 struct filenamenode *iterfilenext(struct fileiterator *i);
 void iterfileend(struct fileiterator *i);
 
+void ensure_package_clientdata(struct pkginfo *pkg);
+
 void ensure_diversions(void);
 void ensure_statoverrides(void);
 

+ 0 - 8
src/help.c

@@ -113,14 +113,6 @@ void checkpath(void) {
                 warned);
 }
 
-void ensure_package_clientdata(struct pkginfo *pkg) {
-  if (pkg->clientdata) return;
-  pkg->clientdata= nfmalloc(sizeof(struct perpackagestate));
-  pkg->clientdata->istobe= itb_normal;
-  pkg->clientdata->fileslistvalid= 0;
-  pkg->clientdata->files = NULL;
-}
-
 int ignore_depends(struct pkginfo *pkg) {
   struct packageinlist *id;
   for (id= ignoredependss; id; id= id->next)

+ 0 - 1
src/main.h

@@ -181,7 +181,6 @@ int force_depends(struct deppossi *possi);
 int force_conff_new(struct deppossi *possi);
 int force_conff_miss(struct deppossi *possi);
 int force_conflicts(struct deppossi *possi);
-void ensure_package_clientdata(struct pkginfo *pkg);
 void oldconffsetflags(const struct conffile *searchconff);
 void ensure_pathname_nonexisting(const char *pathname);
 int chmodsafe_unlink(const char *pathname, const char **failed);

+ 0 - 8
src/query.c

@@ -46,14 +46,6 @@
 static const char* showformat		= "${Package}\t${Version}\n";
 
 
-void ensure_package_clientdata(struct pkginfo *pkg) {
-  if (pkg->clientdata) return;
-  pkg->clientdata= nfmalloc(sizeof(struct perpackagestate));
-  pkg->clientdata->istobe= itb_normal;
-  pkg->clientdata->fileslistvalid= 0;
-  pkg->clientdata->files= 0;
-}
-
 int pkglistqsortcmp(const void *a, const void *b) {
   const struct pkginfo *pa= *(const struct pkginfo**)a;
   const struct pkginfo *pb= *(const struct pkginfo**)b;