summary refs log tree commit diff
path: root/wcsmbs/mbrtowc.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2012-01-08 07:19:21 -0500
committerUlrich Drepper <drepper@gmail.com>2012-01-08 07:19:21 -0500
commitd3ed722566f42d3f614b1221a8e4f19092976531 (patch)
tree4a63e059ef599167cf407311188551fe72221d8d /wcsmbs/mbrtowc.c
parenta0da5fe1e49b819b4d90b77915e21cddd397d064 (diff)
downloadglibc-d3ed722566f42d3f614b1221a8e4f19092976531.tar.gz
glibc-d3ed722566f42d3f614b1221a8e4f19092976531.tar.xz
glibc-d3ed722566f42d3f614b1221a8e4f19092976531.zip
Simplify char16_t implementation
Diffstat (limited to 'wcsmbs/mbrtowc.c')
-rw-r--r--wcsmbs/mbrtowc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/wcsmbs/mbrtowc.c b/wcsmbs/mbrtowc.c
index 03b8348d30..0c99b7401d 100644
--- a/wcsmbs/mbrtowc.c
+++ b/wcsmbs/mbrtowc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2004, 2005, 2011
+/* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2004, 2005, 2011, 2012
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -73,7 +73,11 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
   inbuf = (const unsigned char *) s;
   endbuf = inbuf + n;
   if (__builtin_expect (endbuf < inbuf, 0))
-    endbuf = (const unsigned char *) ~(uintptr_t) 0;
+    {
+      endbuf = (const unsigned char *) ~(uintptr_t) 0;
+      if (endbuf == inbuf)
+	goto ilseq;
+    }
   __gconv_fct fct = fcts->towc->__fct;
 #ifdef PTR_DEMANGLE
   if (fcts->towc->__shlib_handle != NULL)
@@ -108,6 +112,7 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
     result = (size_t) -2;
   else
     {
+    ilseq:
       result = (size_t) -1;
       __set_errno (EILSEQ);
     }