This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=7b18e7f53032bd482065d322dc4532fe436f6430 commit 7b18e7f53032bd482065d322dc4532fe436f6430 Author: Guillem Jover <[email protected]> AuthorDate: Thu Feb 23 20:14:54 2023 +0100 libdpkg: Rename FHFF_NONE to FHFF_NONEW The _NONE name tends to signify lack of flags, which can be confusing here where it refers to not finding an existing node and then not inserting a new one. --- lib/dpkg/fsys-hash.c | 2 +- lib/dpkg/fsys.h | 4 ++-- lib/dpkg/t/t-fsys-hash.c | 14 +++++++------- lib/dpkg/triglib.h | 2 +- src/divert/main.c | 6 +++--- src/statoverride/main.c | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/dpkg/fsys-hash.c b/lib/dpkg/fsys-hash.c index e3ba00e03..5794c96fd 100644 --- a/lib/dpkg/fsys-hash.c +++ b/lib/dpkg/fsys-hash.c @@ -93,7 +93,7 @@ fsys_hash_find_node(const char *name, enum fsys_hash_find_flags flags) pointerp = &(*pointerp)->next; } - if (flags & FHFF_NONE) + if (flags & FHFF_NONEW) return NULL; newnode = nfmalloc(sizeof(*newnode)); diff --git a/lib/dpkg/fsys.h b/lib/dpkg/fsys.h index 6bb0d09d4..1516f170b 100644 --- a/lib/dpkg/fsys.h +++ b/lib/dpkg/fsys.h @@ -56,8 +56,8 @@ struct pkginfo; enum fsys_hash_find_flags { /** Do not need to copy filename. */ FHFF_NOCOPY = DPKG_BIT(0), - /** The find function might return NULL. */ - FHFF_NONE = DPKG_BIT(1), + /** Do not insert the item if it is not found, and return NULL. */ + FHFF_NONEW = DPKG_BIT(1), }; enum fsys_namenode_flags { diff --git a/lib/dpkg/t/t-fsys-hash.c b/lib/dpkg/t/t-fsys-hash.c index 7739328e5..afb238ca8 100644 --- a/lib/dpkg/t/t-fsys-hash.c +++ b/lib/dpkg/t/t-fsys-hash.c @@ -36,7 +36,7 @@ test_fsys_nodes(void) fsys_hash_init(); - fnn = fsys_hash_find_node("/nonexistent", FHFF_NONE); + fnn = fsys_hash_find_node("/nonexistent", FHFF_NONEW); test_pass(fnn == NULL); test_pass(fsys_hash_entries() == 0); @@ -81,21 +81,21 @@ test_fsys_nodes(void) fsys_hash_init(); test_pass(fsys_hash_entries() == 3); - fnn = fsys_hash_find_node("/test/path/aa", FHFF_NONE); + fnn = fsys_hash_find_node("/test/path/aa", FHFF_NONEW); test_pass(fnn != NULL); - fnn = fsys_hash_find_node("/test/path/bb", FHFF_NONE); + fnn = fsys_hash_find_node("/test/path/bb", FHFF_NONEW); test_pass(fnn != NULL); - fnn = fsys_hash_find_node("/test/path/cc", FHFF_NONE); + fnn = fsys_hash_find_node("/test/path/cc", FHFF_NONEW); test_pass(fnn != NULL); test_pass(fsys_hash_entries() == 3); fsys_hash_reset(); test_pass(fsys_hash_entries() == 0); - fnn = fsys_hash_find_node("/test/path/aa", FHFF_NONE); + fnn = fsys_hash_find_node("/test/path/aa", FHFF_NONEW); test_pass(fnn == NULL); - fnn = fsys_hash_find_node("/test/path/bb", FHFF_NONE); + fnn = fsys_hash_find_node("/test/path/bb", FHFF_NONEW); test_pass(fnn == NULL); - fnn = fsys_hash_find_node("/test/path/cc", FHFF_NONE); + fnn = fsys_hash_find_node("/test/path/cc", FHFF_NONEW); test_pass(fnn == NULL); test_pass(fsys_hash_entries() == 0); } diff --git a/lib/dpkg/triglib.h b/lib/dpkg/triglib.h index b4c772516..b8666fc17 100644 --- a/lib/dpkg/triglib.h +++ b/lib/dpkg/triglib.h @@ -80,7 +80,7 @@ struct trig_hooks { #define TRIGHOOKS_DEFINE_NAMENODE_ACCESSORS \ static struct fsys_namenode *th_nn_find(const char *name, bool nonew) \ - { return fsys_hash_find_node(name, nonew ? FHFF_NONE : 0); } \ + { return fsys_hash_find_node(name, nonew ? FHFF_NONEW : 0); } \ static struct trigfileint **th_nn_interested(struct fsys_namenode *fnn) \ { return &fnn->trig_interested; } \ static const char *th_nn_name(struct fsys_namenode *fnn) \ diff --git a/src/divert/main.c b/src/divert/main.c index 865796d3a..31ba4c080 100644 --- a/src/divert/main.c +++ b/src/divert/main.c @@ -630,7 +630,7 @@ diversion_remove(const char *const *argv) modstatdb_open(msdbrw_readonly); ensure_diversions(); - namenode = fsys_hash_find_node(filename, FHFF_NONE); + namenode = fsys_hash_find_node(filename, FHFF_NONEW); if (namenode == NULL || namenode->divert == NULL || namenode->divert->useinstead == NULL) { @@ -763,7 +763,7 @@ diversion_truename(const char *const *argv) modstatdb_open(msdbrw_readonly); ensure_diversions(); - namenode = fsys_hash_find_node(filename, FHFF_NONE); + namenode = fsys_hash_find_node(filename, FHFF_NONEW); /* Print the given name if file is not diverted. */ if (namenode && namenode->divert && namenode->divert->useinstead) @@ -790,7 +790,7 @@ diversion_listpackage(const char *const *argv) modstatdb_open(msdbrw_readonly); ensure_diversions(); - namenode = fsys_hash_find_node(filename, FHFF_NONE); + namenode = fsys_hash_find_node(filename, FHFF_NONEW); /* Print nothing if file is not diverted. */ if (namenode == NULL || namenode->divert == NULL) diff --git a/src/statoverride/main.c b/src/statoverride/main.c index 66fe8c34e..6304d46d5 100644 --- a/src/statoverride/main.c +++ b/src/statoverride/main.c @@ -159,7 +159,7 @@ statdb_node_remove(const char *filename) { struct fsys_namenode *file; - file = fsys_hash_find_node(filename, FHFF_NONE); + file = fsys_hash_find_node(filename, FHFF_NONEW); if (!file || !file->statoverride) return 0; -- Dpkg.Org's dpkg

