]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
hwdb: rename hwdb_bin_paths -> HWDB_BIN_PATHS
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 21 Aug 2024 17:08:20 +0000 (02:08 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 21 Aug 2024 19:26:07 +0000 (04:26 +0900)
We usually use upper letters for constant definitions.

src/libsystemd/sd-hwdb/hwdb-internal.h
src/libsystemd/sd-hwdb/sd-hwdb.c
src/shared/hwdb-util.c
src/test/test-sd-hwdb.c

index 9db3b314416e4aa61d4aad5169c4a188b698eb3c..b26eb594edc5a8d613dfae5458d455a9793a7410 100644 (file)
@@ -82,7 +82,7 @@ struct trie_value_entry2_f {
         le16_t padding;
 } _packed_;
 
-#define hwdb_bin_paths                          \
+#define HWDB_BIN_PATHS                          \
         "/etc/systemd/hwdb/hwdb.bin\0"          \
         "/etc/udev/hwdb.bin\0"                  \
         "/usr/lib/systemd/hwdb/hwdb.bin\0"      \
index 11c5092bc97fb6bd9d86e759bc8c63dad57bf911..588fb0313bca7da65d960d38d60683c8352f7c37 100644 (file)
@@ -289,14 +289,14 @@ static int hwdb_new(const char *path, sd_hwdb **ret) {
 
         hwdb->n_ref = 1;
 
-        /* Find hwdb.bin in the explicit path if provided, or iterate over hwdb_bin_paths otherwise  */
+        /* Find hwdb.bin in the explicit path if provided, or iterate over HWDB_BIN_PATHS otherwise  */
         if (!isempty(path)) {
                 log_debug("Trying to open \"%s\"...", path);
                 hwdb->f = fopen(path, "re");
                 if (!hwdb->f)
                         return log_debug_errno(errno, "Failed to open %s: %m", path);
         } else {
-                NULSTR_FOREACH(p, hwdb_bin_paths) {
+                NULSTR_FOREACH(p, HWDB_BIN_PATHS) {
                         log_debug("Trying to open \"%s\"...", p);
                         hwdb->f = fopen(p, "re");
                         if (hwdb->f) {
index c99f5102363dfb1623d1c7dd8a5a760ddb860898..afc1f54da3df4769aebe11eaef84f2a56dec4bee 100644 (file)
@@ -667,7 +667,7 @@ int hwdb_query(const char *modalias, const char *root) {
         assert(modalias);
 
         if (!isempty(root))
-                NULSTR_FOREACH(p, hwdb_bin_paths) {
+                NULSTR_FOREACH(p, HWDB_BIN_PATHS) {
                         _cleanup_free_ char *hwdb_bin = NULL;
 
                         hwdb_bin = path_join(root, p);
@@ -699,7 +699,7 @@ bool hwdb_should_reload(sd_hwdb *hwdb) {
                 return false;
 
         /* if hwdb.bin doesn't exist anywhere, we need to update */
-        NULSTR_FOREACH(p, hwdb_bin_paths)
+        NULSTR_FOREACH(p, HWDB_BIN_PATHS)
                 if (stat(p, &st) >= 0) {
                         found = true;
                         break;
index 307609ce32ec4c8362d2aab8e541c754d8261e29..7689cdf9a480be031b042dd0d3f95b629bec2010 100644 (file)
@@ -62,7 +62,7 @@ TEST(sd_hwdb_new_from_path) {
         ASSERT_RETURN_EXPECTED_SE(sd_hwdb_new_from_path("", &hwdb) == -EINVAL);
         assert_se(sd_hwdb_new_from_path("/path/that/should/not/exist", &hwdb) < 0);
 
-        NULSTR_FOREACH(hwdb_bin_path, hwdb_bin_paths) {
+        NULSTR_FOREACH(hwdb_bin_path, HWDB_BIN_PATHS) {
                 r = sd_hwdb_new_from_path(hwdb_bin_path, &hwdb);
                 if (r >= 0)
                         break;