(fnmatch): Rearrange code to avoid maybe unitialized wstring/wpattern var
authordrepper <drepper>
Sat, 28 Jul 2007 20:35:00 +0000 (20:35 +0000)
committerdrepper <drepper>
Sat, 28 Jul 2007 20:35:00 +0000 (20:35 +0000)
warnings.

posix/fnmatch.c

index c6cdb88..4baef9e 100644 (file)
@@ -351,10 +351,14 @@ fnmatch (pattern, string, flags)
               already done?  */
            return -1;
          if (p)
-           memset (&ps, '\0', sizeof (ps));
+           {
+             memset (&ps, '\0', sizeof (ps));
+             goto prepare_wpattern;
+           }
        }
-      if (__builtin_expect (p != NULL, 0))
+      else
        {
+       prepare_wpattern:
          n = mbsrtowcs (NULL, &pattern, 0, &ps);
          if (__builtin_expect (n == (size_t) -1, 0))
            /* Something wrong.
@@ -383,10 +387,14 @@ fnmatch (pattern, string, flags)
               already done?  */
            return -1;
          if (p)
-           memset (&ps, '\0', sizeof (ps));
+           {
+             memset (&ps, '\0', sizeof (ps));
+             goto prepare_wstring;
+           }
        }
-      if (__builtin_expect (p != NULL, 0))
+      else
        {
+       prepare_wstring:
          n = mbsrtowcs (NULL, &string, 0, &ps);
          if (__builtin_expect (n == (size_t) -1, 0))
            /* Something wrong.