Import upstream version 1.29
[debian/tar] / gnu / regex_internal.c
index 4f18e9db9dbb37a865a5de7716e6ffbd5020bdfc..47f1ccb744cafb9ee04fc161dabb0021db68fa46 100644 (file)
@@ -1,7 +1,5 @@
-/* -*- buffer-read-only: t -*- vi: set ro: */
-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
 /* Extended regular expression matching and search library.
-   Copyright (C) 2002-2013 Free Software Foundation, Inc.
+   Copyright (C) 2002-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
 
@@ -313,12 +311,11 @@ build_wcs_upper_buffer (re_string_t *pstr)
                               + byte_idx), remain_len, &pstr->cur_state);
          if (BE (mbclen < (size_t) -2, 1))
            {
-             wchar_t wcu = wc;
-             if (iswlower (wc))
+             wchar_t wcu = towupper (wc);
+             if (wcu != wc)
                {
                  size_t mbcdlen;
 
-                 wcu = towupper (wc);
                  mbcdlen = wcrtomb (buf, wcu, &prev_st);
                  if (BE (mbclen == mbcdlen, 1))
                    memcpy (pstr->mbs + byte_idx, buf, mbclen);
@@ -383,12 +380,11 @@ build_wcs_upper_buffer (re_string_t *pstr)
        mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state);
        if (BE (mbclen < (size_t) -2, 1))
          {
-           wchar_t wcu = wc;
-           if (iswlower (wc))
+           wchar_t wcu = towupper (wc);
+           if (wcu != wc)
              {
                size_t mbcdlen;
 
-               wcu = towupper (wc);
                mbcdlen = wcrtomb ((char *) buf, wcu, &prev_st);
                if (BE (mbclen == mbcdlen, 1))
                  memcpy (pstr->mbs + byte_idx, buf, mbclen);
@@ -540,10 +536,7 @@ build_upper_buffer (re_string_t *pstr)
       int ch = pstr->raw_mbs[pstr->raw_mbs_idx + char_idx];
       if (BE (pstr->trans != NULL, 0))
        ch = pstr->trans[ch];
-      if (islower (ch))
-       pstr->mbs[char_idx] = toupper (ch);
-      else
-       pstr->mbs[char_idx] = ch;
+      pstr->mbs[char_idx] = toupper (ch);
     }
   pstr->valid_len = char_idx;
   pstr->valid_raw_len = char_idx;
@@ -684,7 +677,7 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags)
                         pstr->valid_len - offset);
              pstr->valid_len -= offset;
              pstr->valid_raw_len -= offset;
-#if DEBUG
+#if defined DEBUG && DEBUG
              assert (pstr->valid_len > 0);
 #endif
            }
@@ -943,7 +936,7 @@ re_string_context_at (const re_string_t *input, Idx idx, int eflags)
       Idx wc_idx = idx;
       while(input->wcs[wc_idx] == WEOF)
        {
-#ifdef DEBUG
+#if defined DEBUG && DEBUG
          /* It must not happen.  */
          assert (REG_VALID_INDEX (wc_idx));
 #endif