diff options
author | Guillem Jover <guillem@debian.org> | 2015-02-20 02:16:10 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2015-04-01 04:54:50 +0200 |
commit | 595395466b0820b8231bb4ef373b976e9bb8152a (patch) | |
tree | 061c8cd8a12cebcf0a19c7686ea799e925de6f72 /src | |
parent | ce4f0311e6e7a7b5125c4e881a0f2d3a8e1eea45 (diff) | |
download | dpkg-595395466b0820b8231bb4ef373b976e9bb8152a.tar.gz |
dpkg: Rework oldconffsetflags() into pkg_conffiles_mark_old()
Change the signature to take a pkginfo instead of a list of conffiles.
And turn the while loop into a for loop.
Diffstat (limited to 'src')
-rw-r--r-- | src/help.c | 21 | ||||
-rw-r--r-- | src/main.h | 2 | ||||
-rw-r--r-- | src/remove.c | 2 | ||||
-rw-r--r-- | src/unpack.c | 4 | ||||
-rw-r--r-- | src/verify.c | 2 |
5 files changed, 19 insertions, 12 deletions
diff --git a/src/help.c b/src/help.c index 77cf9f89c..ea773ae48 100644 --- a/src/help.c +++ b/src/help.c @@ -319,17 +319,24 @@ conffile_mark_obsolete(struct pkginfo *pkg, struct filenamenode *namenode) } } -void oldconffsetflags(const struct conffile *searchconff) { +/** + * Mark all package conffiles as old. + * + * @param pkg The package owning the conffiles. + */ +void +pkg_conffiles_mark_old(struct pkginfo *pkg) +{ + const struct conffile *conff; struct filenamenode *namenode; - while (searchconff) { - namenode= findnamenode(searchconff->name, 0); /* XXX */ + for (conff = pkg->installed.conffiles; conff; conff = conff->next) { + namenode = findnamenode(conff->name, 0); /* XXX */ namenode->flags |= fnnf_old_conff; if (!namenode->oldhash) - namenode->oldhash= searchconff->hash; - debug(dbg_conffdetail, "oldconffsetflags '%s' namenode '%s' flags %o", - searchconff->name, namenode->name, namenode->flags); - searchconff= searchconff->next; + namenode->oldhash = conff->hash; + debug(dbg_conffdetail, "%s '%s' namenode '%s' flags %o", __func__, + conff->name, namenode->name, namenode->flags); } } diff --git a/src/main.h b/src/main.h index 946d26616..4680d2c27 100644 --- a/src/main.h +++ b/src/main.h @@ -241,7 +241,7 @@ bool force_breaks(struct deppossi *possi); bool force_depends(struct deppossi *possi); bool force_conflicts(struct deppossi *possi); void conffile_mark_obsolete(struct pkginfo *pkg, struct filenamenode *namenode); -void oldconffsetflags(const struct conffile *searchconff); +void pkg_conffiles_mark_old(struct pkginfo *pkg); void checkpath(void); struct filenamenode *namenodetouse(struct filenamenode *namenode, diff --git a/src/remove.c b/src/remove.c index 96a82e33a..558f3fecd 100644 --- a/src/remove.c +++ b/src/remove.c @@ -169,7 +169,7 @@ void deferred_remove(struct pkginfo *pkg) { return; } - oldconffsetflags(pkg->installed.conffiles); + pkg_conffiles_mark_old(pkg); printf(_("Removing %s (%s) ...\n"), pkg_name(pkg, pnaw_nonambig), versiondescribe(&pkg->installed.version, vdew_nonambig)); diff --git a/src/unpack.c b/src/unpack.c index 0e9acb1a8..fc9b17962 100644 --- a/src/unpack.c +++ b/src/unpack.c @@ -724,11 +724,11 @@ void process_archive(const char *filename) { /* All the old conffiles are marked with a flag, so that we don't delete * them if they seem to disappear completely. */ - oldconffsetflags(pkg->installed.conffiles); + pkg_conffiles_mark_old(pkg); for (conflictor_iter = conflictors.head; conflictor_iter; conflictor_iter = conflictor_iter->next) - oldconffsetflags(conflictor_iter->pkg->installed.conffiles); + pkg_conffiles_mark_old(conflictor_iter->pkg); oldversionstatus= pkg->status; diff --git a/src/verify.c b/src/verify.c index 9e32f163a..3eb70df31 100644 --- a/src/verify.c +++ b/src/verify.c @@ -99,7 +99,7 @@ verify_package(struct pkginfo *pkg) ensure_packagefiles_available(pkg); parse_filehash(pkg, &pkg->installed); - oldconffsetflags(pkg->installed.conffiles); + pkg_conffiles_mark_old(pkg); for (file = pkg->clientdata->files; file; file = file->next) { struct verify_checks checks; |