]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Fri, 10 Aug 2001 05:59:19 +0000 (05:59 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 10 Aug 2001 05:59:19 +0000 (05:59 +0000)
* posix/fnmatch_loop.c: Fix computation of alignment.

2001-08-09  Isamu Hasegawa  <isamu@yamato.ibm.com>

* posix/regex.c (wcs_regex_compile): Use appropriate string
to compare with collating element.
Fix the padding for the alignment.

2001-08-09  Isamu Hasegawa  <isamu@yamato.ibm.com>

* locale/programs/ld-collate.c (collate_output): Exclude
characters from elem_table.
Reduce if clause to write collating elements correctly.
* posix/Makefile (tests): Add bug-regex5.
* posix/bug-regex5.c: New file.

2001-08-09  Ulrich Drepper  <drepper@redhat.com>

ChangeLog
locale/programs/ld-collate.c
posix/Makefile
posix/bug-regex5.c [new file with mode: 0644]
posix/fnmatch_loop.c
posix/regex.c

index 28c6a24f8bd8f0945a253a5940cb20023cd5dbc5..679df25385eb6d5df4e12cf4476d27d0af649f78 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2001-08-09  Ulrich Drepper  <drepper@redhat.com>
+
+       * posix/fnmatch_loop.c: Fix computation of alignment.
+
+2001-08-09  Isamu Hasegawa  <isamu@yamato.ibm.com>
+
+       * posix/regex.c (wcs_regex_compile): Use appropriate string
+       to compare with collating element.
+       Fix the padding for the alignment.
+
+2001-08-09  Isamu Hasegawa  <isamu@yamato.ibm.com>
+
+       * locale/programs/ld-collate.c (collate_output): Exclude
+       characters from elem_table.
+       Reduce if clause to write collating elements correctly.
+       * posix/Makefile (tests): Add bug-regex5.
+       * posix/bug-regex5.c: New file.
+
 2001-08-09  Ulrich Drepper  <drepper@redhat.com>
 
        * locale/lc-time.c (_nl_parse_alt_digit): New function.
index d19e3bba59a52e88b64bc7af6cf57af05a76c19d..e901558bd19300d955036b579d5eaa4fc0f52638 100644 (file)
@@ -2449,7 +2449,7 @@ collate_output (struct localedef_t *locale, struct charmap_t *charmap,
   runp = collate->start;
   while (runp != NULL)
     {
-      if (runp->mbs != NULL && runp->weights != NULL)
+      if (runp->mbs != NULL && runp->weights != NULL && !runp->is_character)
        {
          /* Compute the hash value of the name.  */
          uint32_t namelen = strlen (runp->name);
@@ -2469,37 +2469,36 @@ collate_output (struct localedef_t *locale, struct charmap_t *charmap,
                    idx -= elem_size;
                }
              while (elem_table[idx * 2] != 0);
+           }
+         /* This is the spot where we will insert the value.  */
+         elem_table[idx * 2] = hash;
+         elem_table[idx * 2 + 1] = obstack_object_size (&extrapool);
 
-             /* This is the spot where we will insert the value.  */
-             elem_table[idx * 2] = hash;
-             elem_table[idx * 2 + 1] = obstack_object_size (&extrapool);
-
-             /* The the string itself including length.  */
-             obstack_1grow (&extrapool, namelen);
-             obstack_grow (&extrapool, runp->name, namelen);
+         /* The the string itself including length.  */
+         obstack_1grow (&extrapool, namelen);
+         obstack_grow (&extrapool, runp->name, namelen);
 
-             /* And the multibyte representation.  */
-             obstack_1grow (&extrapool, runp->nmbs);
-             obstack_grow (&extrapool, runp->mbs, runp->nmbs);
+         /* And the multibyte representation.  */
+         obstack_1grow (&extrapool, runp->nmbs);
+         obstack_grow (&extrapool, runp->mbs, runp->nmbs);
 
-             /* And align again to 32 bits.  */
-             if ((1 + namelen + 1 + runp->nmbs) % sizeof (int32_t) != 0)
-               obstack_grow (&extrapool, "\0\0",
-                             (sizeof (int32_t)
-                              - ((1 + namelen + 1 + runp->nmbs)
-                                 % sizeof (int32_t))));
+         /* And align again to 32 bits.  */
+         if ((1 + namelen + 1 + runp->nmbs) % sizeof (int32_t) != 0)
+           obstack_grow (&extrapool, "\0\0",
+                         (sizeof (int32_t)
+                          - ((1 + namelen + 1 + runp->nmbs)
+                             % sizeof (int32_t))));
 
-             /* Now some 32-bit values: multibyte collation sequence,
-                wide char string (including length), and wide char
-                collation sequence.  */
-             obstack_int32_grow (&extrapool, runp->mbseqorder);
+         /* Now some 32-bit values: multibyte collation sequence,
+            wide char string (including length), and wide char
+            collation sequence.  */
+         obstack_int32_grow (&extrapool, runp->mbseqorder);
 
-             obstack_int32_grow (&extrapool, runp->nwcs);
-             obstack_grow (&extrapool, runp->wcs,
-                           runp->nwcs * sizeof (uint32_t));
+         obstack_int32_grow (&extrapool, runp->nwcs);
+         obstack_grow (&extrapool, runp->wcs,
+                       runp->nwcs * sizeof (uint32_t));
 
-             obstack_int32_grow (&extrapool, runp->wcseqorder);
-           }
+         obstack_int32_grow (&extrapool, runp->wcseqorder);
        }
 
       runp = runp->next;
index ff20bec4c1594078d4c8b84bf14aafb8b0aa3c81..3575749dd66ad14291d457d17dcd6da3042c1118 100644 (file)
@@ -70,7 +70,7 @@ tests         := tstgetopt testfnm runtests runptests      \
                   tst-getlogin tst-mmap tst-getaddrinfo tst-truncate \
                   tst-truncate64 tst-fork tst-fnmatch tst-regexloc tst-dir \
                   tst-chmod bug-regex1 bug-regex2 bug-regex3 bug-regex4 \
-                  tst-gnuglob tst-regex
+                  tst-gnuglob tst-regex bug-regex5
 ifeq (yes,$(build-shared))
 test-srcs      := globtest
 tests           += wordexp-test tst-exec tst-spawn
@@ -123,6 +123,7 @@ tst-fnmatch-ENV = LOCPATH=$(common-objpfx)localedata
 tst-regexloc-ENV = LOCPATH=$(common-objpfx)localedata
 bug-regex1-ENV = LOCPATH=$(common-objpfx)localedata
 tst-regex-ENV = LOCPATH=$(common-objpfx)localedata
+bug-regex5-ENV = LOCPATH=$(common-objpfx)localedata
 
 testcases.h: TESTS TESTS2C.sed
        sed -f TESTS2C.sed < $< > $@T
diff --git a/posix/bug-regex5.c b/posix/bug-regex5.c
new file mode 100644 (file)
index 0000000..12bbcff
--- /dev/null
@@ -0,0 +1,61 @@
+#include <stdio.h>
+#include <string.h>
+#include <locale.h>
+#include <locale/localeinfo.h>
+
+int
+main (void)
+{
+  int32_t table_size, idx, i, found;
+  const int32_t *symb_table;
+  const unsigned char *extra;
+  uint32_t nrules;
+  char *ca;
+
+  ca = setlocale (LC_ALL, "da_DK.ISO-8859-1");
+  if (ca == NULL)
+    {
+      printf ("cannot set locale: %m\n");
+      return 1;
+    }
+  printf ("current locale : %s\n", ca);
+
+  nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
+  if (nrules == 0)
+    {
+      printf("No rule\n");
+      return 1;
+    }
+
+  table_size = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_SYMB_HASH_SIZEMB);
+  symb_table = (const int32_t *)
+    _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_TABLEMB);
+  extra = (const unsigned char *)
+    _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
+
+  found = 0;
+  for (i = 0; i < table_size; ++i)
+    {
+      if (symb_table[2 * i] != 0)
+       {
+         char elem[256];
+         idx = symb_table[2 * i + 1];
+         strncpy (elem, extra + idx + 1, extra[idx]);
+         elem[extra[idx]] = '\0';
+         printf ("Found a collating element: %s\n", elem);
+         ++found;
+       }
+    }
+  if (found == 0)
+    {
+      printf ("No collating element!\n");
+      return 1;
+    }
+  else if (found != 4)
+    {
+      printf ("expected 4 collating elements, found %d\n", found);
+      return 1;
+    }
+
+  return 0;
+}
index 4f2e4a3d932923ade1c10118a59aeb2a7005572e..4c6168ae9fe44db73e3c7e4df7210a90ac2acff3 100644 (file)
@@ -531,7 +531,7 @@ FCT (pattern, string, string_end, no_leading_period, flags)
 
                                idx += 1 + extra[idx];
                                /* Adjust for the alignment.  */
-                               idx = (idx + 3) & ~4;
+                               idx = (idx + 3) & ~3;
 
                                wextra = (int32_t *) &extra[idx + 4];
 # endif
index e4ac58bfbc6b5921ddd4cd3bbe8810547473ccca..ee38fdfd2e623ba429c67dfe68bc548ca04b1732 100644 (file)
@@ -3055,7 +3055,7 @@ PREFIX(regex_compile) (ARG_PREFIX(pattern), ARG_PREFIX(size), syntax, bufp)
                                    /* First compare the hashing value.  */
                                    if (symb_table[2 * elem] == hash
                                        && c1 == extra[symb_table[2 * elem + 1]]
-                                       && memcmp (str,
+                                       && memcmp (char_str,
                                                   &extra[symb_table[2 * elem + 1]
                                                         + 1], c1) == 0)
                                      {
@@ -3075,7 +3075,7 @@ PREFIX(regex_compile) (ARG_PREFIX(pattern), ARG_PREFIX(size), syntax, bufp)
                                       in the table.  */
                                    idx += 1 + extra[idx];
                                    /* Adjust for the alignment.  */
-                                   idx = (idx + 3) & ~4;
+                                   idx = (idx + 3) & ~3;
 
                                    str[0] = (wchar_t) idx + 4;
                                  }