From 175aa99c46f11561bcc456efa88a1653d1270069 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 20 Mar 2008 07:04:22 +0200 Subject: [PATCH] Move duplicate pkgadminfile functions to lib/dbmodify.c --- ChangeLog | 8 ++++++++ lib/dbmodify.c | 12 ++++++++++++ lib/dpkg-db.h | 2 ++ src/help.c | 12 ------------ src/main.h | 1 - src/query.c | 12 ------------ 6 files changed, 22 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51d972fc..02345a74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-03-20 Ian Jackson + + * src/main.h (pkgadminfile): Move prototype to ... + * lib/dpkg-db.h: ... here. + * src/help.c (pkgadminfile): Move function definition to ... + * lib/dbmodify.c: ... here. + * src/query.c (pkgadminfile): Remove duplicated functions. + 2008-03-20 Ian Jackson , Guillem Jover diff --git a/lib/dbmodify.c b/lib/dbmodify.c index cfc95cab..ba85037f 100644 --- a/lib/dbmodify.c +++ b/lib/dbmodify.c @@ -288,6 +288,18 @@ void modstatdb_note(struct pkginfo *pkg) { onerr_abort--; } +const char *pkgadminfile(struct pkginfo *pkg, const char *whichfile) { + static struct varbuf vb; + varbufreset(&vb); + varbufaddstr(&vb,admindir); + varbufaddstr(&vb,"/" INFODIR); + varbufaddstr(&vb,pkg->name); + varbufaddc(&vb,'.'); + varbufaddstr(&vb,whichfile); + varbufaddc(&vb,0); + return vb.buf; +} + const char *log_file= NULL; void log_message(const char *fmt, ...) { diff --git a/lib/dpkg-db.h b/lib/dpkg-db.h index 9f8de44e..c306f3bf 100644 --- a/lib/dpkg-db.h +++ b/lib/dpkg-db.h @@ -175,6 +175,8 @@ void modstatdb_shutdown(void); extern char *statusfile, *availablefile; /* initialised by modstatdb_init */ +const char *pkgadminfile(struct pkginfo *pkg, const char *whichfile); + extern const char *log_file; void log_message(const char *fmt, ...) PRINTFFORMAT(1, 2); diff --git a/src/help.c b/src/help.c index 5103ecb8..d7f2f040 100644 --- a/src/help.c +++ b/src/help.c @@ -144,18 +144,6 @@ int force_conflicts(struct deppossi *possi) { return fc_conflicts; } -const char *pkgadminfile(struct pkginfo *pkg, const char *whichfile) { - static struct varbuf vb; - varbufreset(&vb); - varbufaddstr(&vb,admindir); - varbufaddstr(&vb,"/" INFODIR); - varbufaddstr(&vb,pkg->name); - varbufaddc(&vb,'.'); - varbufaddstr(&vb,whichfile); - varbufaddc(&vb,0); - return vb.buf; -} - static const char* preexecscript(const char *path, char *const *argv) { /* returns the path to the script inside the chroot * none of the stuff here will work if admindir isn't inside instdir diff --git a/src/main.h b/src/main.h index 59cc9f85..a490e8d4 100644 --- a/src/main.h +++ b/src/main.h @@ -182,7 +182,6 @@ 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); -const char *pkgadminfile(struct pkginfo *pkg, const char *whichfile); 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 91b9111e..c50ddded 100644 --- a/src/query.c +++ b/src/query.c @@ -54,18 +54,6 @@ void ensure_package_clientdata(struct pkginfo *pkg) { pkg->clientdata->files= 0; } -const char *pkgadminfile(struct pkginfo *pkg, const char *whichfile) { - static struct varbuf vb; - varbufreset(&vb); - varbufaddstr(&vb,admindir); - varbufaddstr(&vb,"/" INFODIR); - varbufaddstr(&vb,pkg->name); - varbufaddc(&vb,'.'); - varbufaddstr(&vb,whichfile); - varbufaddc(&vb,0); - return vb.buf; -} - 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