]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: apply suggested cleanup to recent stty.c change
authorPádraig Brady <P@draigBrady.com>
Tue, 24 Oct 2017 06:26:33 +0000 (23:26 -0700)
committerPádraig Brady <P@draigBrady.com>
Tue, 24 Oct 2017 06:31:40 +0000 (23:31 -0700)
This should have been part of commit v8.28-17-gf926f7c
* src/stty.c (check_argument): Align line continuation chars,
and ensure the function macro is immune to usage with if/else.
Suggested by Jim Meyering and Paul Eggert.

src/stty.c

index 1a5c1e9620fe5e5e95004b5c81873388d7254cf2..df963462c1f7619c9cdefdbe2a6845b1f752a9df 100644 (file)
@@ -1089,12 +1089,16 @@ apply_settings (bool checking, const char *device_name,
                 struct termios *mode, bool *speed_was_set,
                 bool *require_set_attr)
 {
-#define check_argument(arg) \
-  if (k == n_settings - 1 || ! settings[k+1]) \
-    { \
-      error (0, 0, _("missing argument to %s"), quote (arg)); \
-      usage (EXIT_FAILURE); \
-    }
+#define check_argument(arg)                                            \
+  do                                                                   \
+    {                                                                  \
+      if (k == n_settings - 1 || ! settings[k+1])                      \
+        {                                                              \
+          error (0, 0, _("missing argument to %s"), quote (arg));      \
+          usage (EXIT_FAILURE);                                                \
+        }                                                              \
+    }                                                                  \
+  while (0)
 
   for (int k = 1; k < n_settings; k++)
     {