summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/systemd/sd-hwdb.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/systemd/sd-hwdb.h b/src/systemd/sd-hwdb.h
index f41555df7e..3c44b981d6 100644
--- a/src/systemd/sd-hwdb.h
+++ b/src/systemd/sd-hwdb.h
@@ -39,8 +39,9 @@ int sd_hwdb_get(sd_hwdb *hwdb, const char *modalias, const char *key, const char
int sd_hwdb_seek(sd_hwdb *hwdb, const char *modalias);
int sd_hwdb_enumerate(sd_hwdb *hwdb, const char **key, const char **value);
+/* the inverse condition avoids ambiguity of danling 'else' after the macro */
#define SD_HWDB_FOREACH_PROPERTY(hwdb, modalias, key, value) \
- if (sd_hwdb_seek(hwdb, modalias) >= 0) \
- while (sd_hwdb_enumerate(hwdb, &(key), &(value)) > 0)
+ if (sd_hwdb_seek(hwdb, modalias) < 0) { } \
+ else while (sd_hwdb_enumerate(hwdb, &(key), &(value)) > 0)
#endif