Update.
authorUlrich Drepper <drepper@redhat.com>
Sat, 13 Mar 2004 06:50:10 +0000 (06:50 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 13 Mar 2004 06:50:10 +0000 (06:50 +0000)
* idna.c (idna_to_ascii_4z): Use strdup if available.  Unify two ifs.

* idn-stub.c: Implement __idna_to_unicode_lzlz.  Split
__idna_to_ascii_lz in two parts so that loading can be shared with
the new function.
* Versions (libcidn): Export idna_to_unicode_lzlz.

libidn/ChangeLog
libidn/Versions
libidn/idna.c

index b5df17cf5c74897dedcb09ede828681945a18265..1903cab56630ed38cd927b5e7d108708e46df58e 100644 (file)
@@ -1,5 +1,12 @@
 2004-03-12  Ulrich Drepper  <drepper@redhat.com>
 
+       * idna.c (idna_to_ascii_4z): Use strdup if available.  Unify two ifs.
+
+       * idn-stub.c: Implement __idna_to_unicode_lzlz.  Split
+       __idna_to_ascii_lz in two parts so that loading can be shared with
+       the new function.
+       * Versions (libcidn): Export idna_to_unicode_lzlz.
+
        * Makefile (libcidn-inhibit-o): Define.  We need no archive.
 
 2004-03-08  Simon Josefsson  <jas@extundo.com>
index 3803a5bb919d8bb474e4aab15ab51fdb5a18f39d..0897fd1717de488f461745df07a4e7b1958d4c6b 100644 (file)
@@ -1,5 +1,6 @@
 libcidn {
   GLIBC_PRIVATE {
     idna_to_ascii_lz;
+    idna_to_unicode_lzlz;
   }
 }
index 69c928fc42c35b8fe99555ce574cdf2899dcb2b1..b89350f1f346c776bf645f26814ba70ca6c13698 100644 (file)
@@ -437,24 +437,21 @@ idna_to_ascii_4z (const uint32_t * input, char **output, int flags)
      U+3002 (ideographic full stop), U+FF0E (fullwidth full stop),
      U+FF61 (halfwidth ideographic full stop). */
 
-  if (input[0] == 0)
+  if (input[0] == 0
+      /* Handle explicit zero-length root label. */
+      || (DOTP (input[0]) && input[1] == 0))
     {
+#if defined HAVE_STRDUP || defined _LIBC
+      *output = strdup (input);
+      return *output == NULL ? IDNA_MALLOC_ERROR : IDNA_SUCCESS;
+#else
       /* Handle implicit zero-length root label. */
       *output = malloc (1);
       if (!*output)
        return IDNA_MALLOC_ERROR;
-      strcpy (*output, "");
-      return IDNA_SUCCESS;
-    }
-
-  if (DOTP (input[0]) && input[1] == 0)
-    {
-      /* Handle explicit zero-length root label. */
-      *output = malloc (2);
-      if (!*output)
-       return IDNA_MALLOC_ERROR;
-      strcpy (*output, ".");
+      strcpy (*output, input);
       return IDNA_SUCCESS;
+#endif
     }
 
   *output = NULL;