Add .cantunwind to _dl_start_user
[platform/upstream/glibc.git] / posix / fnmatch.c
index 819a6a7..a707847 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2007,2010,2011
-       Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -13,9 +12,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #if HAVE_CONFIG_H
 # include <config.h>
 #include <errno.h>
 #include <fnmatch.h>
 #include <ctype.h>
-
-#if HAVE_STRING_H || defined _LIBC
-# include <string.h>
-#else
-# include <strings.h>
-#endif
+#include <string.h>
 
 #if defined STDC_HEADERS || defined _LIBC
 # include <stdlib.h>
@@ -227,6 +220,9 @@ __wcschrnul (s, c)
 # define MEMPCPY(D, S, N) __mempcpy (D, S, N)
 # define MEMCHR(S, C, N) memchr (S, C, N)
 # define STRCOLL(S1, S2) strcoll (S1, S2)
+# define WIDE_CHAR_VERSION 0
+# include <locale/weight.h>
+# define FINDIDX findidx
 # include "fnmatch_loop.c"
 
 
@@ -252,6 +248,12 @@ __wcschrnul (s, c)
 #  define MEMCHR(S, C, N) wmemchr (S, C, N)
 #  define STRCOLL(S1, S2) wcscoll (S1, S2)
 #  define WIDE_CHAR_VERSION 1
+/* Change the name the header defines so it doesn't conflict with
+   the <locale/weight.h> version included above.  */
+#  define findidx findidxwc
+#  include <locale/weightwc.h>
+#  undef findidx
+#  define FINDIDX findidxwc
 
 #  undef IS_CHAR_CLASS
 /* We have to convert the wide character string in a multibyte string.  But
@@ -350,12 +352,12 @@ fnmatch (pattern, string, flags)
 #else
       n = strlen (pattern);
 #endif
-      if (__builtin_expect (n < 1024, 1))
+      if (__glibc_likely (n < 1024))
        {
          wpattern = (wchar_t *) alloca_account ((n + 1) * sizeof (wchar_t),
                                                 alloca_used);
          n = mbsrtowcs (wpattern, &p, n + 1, &ps);
-         if (__builtin_expect (n == (size_t) -1, 0))
+         if (__glibc_unlikely (n == (size_t) -1))
            /* Something wrong.
               XXX Do we have to set `errno' to something which mbsrtows hasn't
               already done?  */
@@ -370,12 +372,12 @@ fnmatch (pattern, string, flags)
        {
        prepare_wpattern:
          n = mbsrtowcs (NULL, &pattern, 0, &ps);
-         if (__builtin_expect (n == (size_t) -1, 0))
+         if (__glibc_unlikely (n == (size_t) -1))
            /* Something wrong.
               XXX Do we have to set `errno' to something which mbsrtows hasn't
               already done?  */
            return -1;
-         if (__builtin_expect (n >= (size_t) -1 / sizeof (wchar_t), 0))
+         if (__glibc_unlikely (n >= (size_t) -1 / sizeof (wchar_t)))
            {
              __set_errno (ENOMEM);
              return -2;
@@ -395,12 +397,12 @@ fnmatch (pattern, string, flags)
       n = strlen (string);
 #endif
       p = string;
-      if (__builtin_expect (n < 1024, 1))
+      if (__glibc_likely (n < 1024))
        {
          wstring = (wchar_t *) alloca_account ((n + 1) * sizeof (wchar_t),
                                                alloca_used);
          n = mbsrtowcs (wstring, &p, n + 1, &ps);
-         if (__builtin_expect (n == (size_t) -1, 0))
+         if (__glibc_unlikely (n == (size_t) -1))
            {
              /* Something wrong.
                 XXX Do we have to set `errno' to something which
@@ -419,12 +421,12 @@ fnmatch (pattern, string, flags)
        {
        prepare_wstring:
          n = mbsrtowcs (NULL, &string, 0, &ps);
-         if (__builtin_expect (n == (size_t) -1, 0))
+         if (__glibc_unlikely (n == (size_t) -1))
            /* Something wrong.
               XXX Do we have to set `errno' to something which mbsrtows hasn't
               already done?  */
            goto free_return;
-         if (__builtin_expect (n >= (size_t) -1 / sizeof (wchar_t), 0))
+         if (__glibc_unlikely (n >= (size_t) -1 / sizeof (wchar_t)))
            {
              free (wpattern_malloc);
              __set_errno (ENOMEM);