]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Suppress GCC 6 warning about ambiguous 'else' with -Wparentheses
authorYvan Roux <yvan.roux@linaro.org>
Fri, 15 Apr 2016 11:29:26 +0000 (13:29 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Thu, 2 Jun 2016 11:13:01 +0000 (13:13 +0200)
(cherry picked from commit df1cf48777fe4cd81ad7fb09ecbe5b31432b7c1c)

ChangeLog
nis/nis_call.c
stdlib/setenv.c

index b09e88fc9ced4924ead8f12678671f727509dbee..ad4640b31390487954b6675120ec0d60ca350b9a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-04-15  Yvan Roux  <yvan.roux@linaro.org>
+
+       * stdlib/setenv.c (unsetenv): Fix ambiguous 'else'.
+       * nis/nis_call.c (nis_server_cache_add): Likewise.
+
 2016-06-01  Florian Weimer  <fweimer@redhat.com>
 
        [BZ #19861]
index 970415b505663fceb14cf4cd6eeb198be88518ed..d98c3859f45fc1c0be6b48b089b9822d4f18362a 100644 (file)
@@ -680,16 +680,18 @@ nis_server_cache_add (const_nis_name name, int search_parent,
   /* Choose which entry should be evicted from the cache.  */
   loc = &nis_server_cache[0];
   if (*loc != NULL)
-    for (i = 1; i < 16; ++i)
-      if (nis_server_cache[i] == NULL)
-       {
+    {
+      for (i = 1; i < 16; ++i)
+       if (nis_server_cache[i] == NULL)
+         {
+           loc = &nis_server_cache[i];
+           break;
+         }
+       else if ((*loc)->uses > nis_server_cache[i]->uses
+                || ((*loc)->uses == nis_server_cache[i]->uses
+                    && (*loc)->expires > nis_server_cache[i]->expires))
          loc = &nis_server_cache[i];
-         break;
-       }
-      else if ((*loc)->uses > nis_server_cache[i]->uses
-              || ((*loc)->uses == nis_server_cache[i]->uses
-                  && (*loc)->expires > nis_server_cache[i]->expires))
-       loc = &nis_server_cache[i];
+    }
   old = *loc;
   *loc = new;
 
index b9e0ba808df053444cbaac645bee72677e8e6000..7a87d642c5ca0ccad37d22843dbf90fda274ef08 100644 (file)
@@ -289,18 +289,20 @@ unsetenv (name)
   ep = __environ;
   if (ep != NULL)
     while (*ep != NULL)
-      if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
-       {
-         /* Found it.  Remove this pointer by moving later ones back.  */
-         char **dp = ep;
-
-         do
-           dp[0] = dp[1];
-         while (*dp++);
-         /* Continue the loop in case NAME appears again.  */
-       }
-      else
-       ++ep;
+      {
+       if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+         {
+           /* Found it.  Remove this pointer by moving later ones back.  */
+           char **dp = ep;
+
+           do
+               dp[0] = dp[1];
+           while (*dp++);
+           /* Continue the loop in case NAME appears again.  */
+         }
+       else
+         ++ep;
+      }
 
   UNLOCK;