summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--locale/programs/ld-collate.c41
2 files changed, 42 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 35be953ab6..4db9d63b11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 1999-12-30  Ulrich Drepper  <drepper@cygnus.com>
 
+	* locale/programs/ld-collate.c (collate_finish): Always define
+	weight for UNDEFINED if not defined by the user but don't complain
+	unless it is needed in the multibyte character table.
+	(collate_output): Add extra dummy elements in wide char tables in the
+	same way done for multibyte.  Always output undefined entry in
+	wide character table.
+
 	* locale/Makefile (categories): Remove commented-out old definition.
 
 	* locale/programs/ld-collate.c (insert_value): Don't pass wide string
@@ -32,7 +39,7 @@
 
 	* soft-fp/*: Tons of new files to implement floating-point arithmetic
 	in software.
-	Contributed by  Richard Henderson, Jakub Jelinek and others.
+	Contributed by Richard Henderson, Jakub Jelinek and others.
 
 1999-12-29  Andreas Jaeger  <aj@suse.de>
 
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 65af8e6b6a..9f4966f2d0 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -1717,17 +1717,24 @@ Computing table size for collation table might take a while..."),
   /* Now determine whether the UNDEFINED entry is needed and if yes,
      whether it was defined.  */
   collate->undefined.used_in_level = need_undefined ? ~0ul : 0;
-  if (need_undefined && collate->undefined.file == NULL)
+  if (collate->undefined.file == NULL)
     {
-      error (0, 0, _("no definition of `UNDEFINED'"));
+      if (need_undefined)
+	{
+	  error (0, 0, _("no definition of `UNDEFINED'"));
 
-      /* Add UNDEFINED at the end.  */
-      collate->undefined.mborder =
-	(int *) obstack_alloc (&collate->mempool, nrules * sizeof (int));
+	  /* Add UNDEFINED at the end.  */
+	  collate->undefined.mborder =
+	    (int *) obstack_alloc (&collate->mempool, nrules * sizeof (int));
 
-      for (i = 0; i < nrules; ++i)
-	collate->undefined.mborder[i] = mbact[i]++;
+	  for (i = 0; i < nrules; ++i)
+	    collate->undefined.mborder[i] = mbact[i]++;
+	}
 
+      /* In any case we will need the definition for the wide character
+	 case.  But we will not complain that it is missing since the
+	 specification strangely enough does not seem to account for
+	 this.  */
       collate->undefined.wcorder = wcact++;
     }
 
@@ -2179,6 +2186,26 @@ collate_output (struct localedef_t *locale, struct charmap_t *charmap,
   idx[1 + cnt] = idx[cnt] + iov[2 + cnt].iov_len;
   ++cnt;
 
+  /* Since we are using the sign of an integer to mark indirection the
+     offsets in the arrays we are indirectly referring to must not be
+     zero since -0 == 0.  Therefore we add a bit of dummy content.  */
+  if (sizeof (int) == sizeof (int32_t))
+    {
+      obstack_int_grow (&extrapool, 0);
+      obstack_int_grow (&indirectpool, 0);
+    }
+  else
+    {
+      int32_t zero = 0;
+      obstack_grow (&extrapool, &zero, sizeof (zero));
+      obstack_grow (&indirectpool, &zero, sizeof (zero));
+    }
+
+  /* Now insert the `UNDEFINED' value if it is used.  Since this value
+     will probably be used more than once it is good to store the
+     weights only once.  */
+  output_weightwc (&weightpool, collate, &collate->undefined);
+
   /* Generate the table.  Walk through the lists of sequences
      starting with the same byte and add them one after the other to
      the table.  In case we have more than one sequence starting with