Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
	* 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.
  • Loading branch information
Ulrich Drepper committed Mar 13, 2004
1 parent 4be2c5f commit a17256a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
7 changes: 7 additions & 0 deletions libidn/ChangeLog
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
1 change: 1 addition & 0 deletions libidn/Versions
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
libcidn {
GLIBC_PRIVATE {
idna_to_ascii_lz;
idna_to_unicode_lzlz;
}
}
21 changes: 9 additions & 12 deletions libidn/idna.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a17256a

Please sign in to comment.