chiark / gitweb /
nspawn: add new option "--port=" for exposing container ports on the local host
[elogind.git] / src / systemd / sd-hwdb.h
index fae9b9fd4bde497b831ce1161e36dea4e935ad27..3c44b981d68030700161c74ba13748d59bae25fa 100644 (file)
@@ -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);
 
-#define FOREACH_HWDB_PROPERTY(hwdb, modalias, key, value)               \
-        if (sd_hwdb_seek(hwdb, modalias) >= 0)                          \
-                while (sd_hwdb_enumerate(hwdb, &(key), &(value)) > 0)
+/* 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) { }                       \
+        else while (sd_hwdb_enumerate(hwdb, &(key), &(value)) > 0)
 
 #endif