From 8003f9dd110881d79c54a1259ccc8c94b8192e82 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Tue, 25 Mar 2008 05:05:51 +0200 Subject: [PATCH] Move duplicate ensure_package_clientdata functions to src/filesdb.c --- ChangeLog | 8 ++++++++ src/filesdb.c | 11 +++++++++++ src/filesdb.h | 2 ++ src/help.c | 8 -------- src/main.h | 1 - src/query.c | 8 -------- 6 files changed, 21 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index a5b707d3..c5ab8e74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-03-25 Guillem Jover + + * 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 * lib/dpkg-db.h (unlockdatabase): Change prototype to not take any diff --git a/src/filesdb.c b/src/filesdb.c index bc5973ba..46b3cbff 100644 --- a/src/filesdb.c +++ b/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); diff --git a/src/filesdb.h b/src/filesdb.h index 912dea12..c4ed8477 100644 --- a/src/filesdb.h +++ b/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); diff --git a/src/help.c b/src/help.c index 6bb9f2a4..2396d39b 100644 --- a/src/help.c +++ b/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) diff --git a/src/main.h b/src/main.h index a490e8d4..101ce2e4 100644 --- a/src/main.h +++ b/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); diff --git a/src/query.c b/src/query.c index ae5f0cad..631ee58c 100644 --- a/src/query.c +++ b/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; -- 2.39.5