chiark / gitweb /
wrap a few *_FOREACH macros in curly braces
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Fri, 12 Dec 2014 18:51:41 +0000 (19:51 +0100)
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Fri, 12 Dec 2014 20:57:44 +0000 (21:57 +0100)
cppcheck would give up with "syntax error" without them. This led
to reports of syntax errors in unrelated locations and potentially
hid other errors

src/core/load-fragment.c
src/journal-remote/journal-remote.c

index 3fbe680cf09e1362ebf6caeb92a357ee51569103..8e5be8731f326ca595a3e3759241610f7093adf0 100644 (file)
@@ -3586,7 +3586,7 @@ int unit_load_fragment(Unit *u) {
                 return r;
 
         /* Try to find an alias we can load this with */
-        if (u->load_state == UNIT_STUB)
+        if (u->load_state == UNIT_STUB) {
                 SET_FOREACH(t, u->names, i) {
 
                         if (t == u->id)
@@ -3599,6 +3599,7 @@ int unit_load_fragment(Unit *u) {
                         if (u->load_state != UNIT_STUB)
                                 break;
                 }
+        }
 
         /* And now, try looking for it under the suggested (originally linked) path */
         if (u->load_state == UNIT_STUB && u->fragment_path) {
@@ -3628,7 +3629,7 @@ int unit_load_fragment(Unit *u) {
                 if (r < 0)
                         return r;
 
-                if (u->load_state == UNIT_STUB)
+                if (u->load_state == UNIT_STUB) {
                         SET_FOREACH(t, u->names, i) {
                                 _cleanup_free_ char *z = NULL;
 
@@ -3646,6 +3647,7 @@ int unit_load_fragment(Unit *u) {
                                 if (u->load_state != UNIT_STUB)
                                         break;
                         }
+                }
         }
 
         return 0;
index 6ec5ad2e77a2f152c4c488f5adcbeb9f5856834c..5050616d84180e6ddc461be83ba90bed55701048 100644 (file)
@@ -1469,13 +1469,13 @@ static int setup_gnutls_logger(char **categories) {
 
                 gnutls_global_set_log_function(log_func_gnutls);
 
-                if (categories)
+                if (categories) {
                         STRV_FOREACH(cat, categories) {
                                 r = log_enable_gnutls_category(*cat);
                                 if (r < 0)
                                         return r;
                         }
-                else
+                else
                         log_reset_gnutls_level();
         }
 #endif