aboutsummaryrefslogtreecommitdiff
path: root/string/strxfrm.c
diff options
context:
space:
mode:
Diffstat (limited to 'string/strxfrm.c')
-rw-r--r--string/strxfrm.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/string/strxfrm.c b/string/strxfrm.c
index 8222adf..795e8e4 100644
--- a/string/strxfrm.c
+++ b/string/strxfrm.c
@@ -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.
@@ -184,6 +184,14 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
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);