Correct problem with empty strings.

This commit is contained in:
Ulrich Drepper 1998-07-22 12:50:16 +00:00
parent 0b630da519
commit f4cc44230e
2 changed files with 16 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@ -52,6 +52,12 @@ STRCOLL (s1, s2)
if (collate_nrules == 0)
return STRCMP (s1, s2);
/* Handle empty strings as a special case. */
if (*s1 == '\0')
return *s2 == '\0' ? 0 : -1;
else if (*s2 == '\0')
return 1;
/* Get full information about the strings. This means we get
information for all passes in a special data structure. */
get_string (s1, s1forw, s1backw);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@ -159,6 +159,14 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n)
return STRLEN (src);
}
/* Handle an empty string as a special case. */
if (*src == '\0')
{
if (n != 0)
*dest = '\0';
return 1;
}
/* Get full information about the string. This means we get
information for all passes in a special data structure. */
get_string (src, forw, backw);