From 9ce5071a3d3af1b7837b1a081548fdd945a66efe Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 21 Apr 1998 19:09:49 +0000 Subject: Update. 1998-04-21 19:05 Ulrich Drepper * iconv/gconv.h (struct gconv_step): Add element stateful. * iconv/gconv_builtin.c (__gconv_builtin_trans): Initialize stateful to zero for all internal conversions. * iconv/skeleton.c: Initialize stateful depending on whether or not RESET_STATE is defined to one or zero respectively. * stdlib/mblen.c: Use stateful element of currently selected converter for result if S is NULL. * stdlib/mbtowc.c: Likewise. * stdlib/wctomb.c: Likewise. --- stdlib/mblen.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'stdlib/mblen.c') diff --git a/stdlib/mblen.c b/stdlib/mblen.c index d60a1fb160..9d8d0ccc5a 100644 --- a/stdlib/mblen.c +++ b/stdlib/mblen.c @@ -18,6 +18,8 @@ #include #include +#include +#include /* Return the length of the multibyte character (if there is one) @@ -32,12 +34,14 @@ mblen (const char *s, size_t n) /* If S is NULL the function has to return null or not null depending on the encoding having a state depending encoding or - not. This is nonsense because any multibyte encoding has a - state. The ISO C amendment 1 corrects this while introducing the - restartable functions. We simply say here all encodings have a - state. */ + not. */ if (s == NULL) - result = 1; + { + /* Make sure we use the correct value. */ + update_conversion_ptrs (); + + result = __wcsmbs_gconv_fcts.towc->stateful; + } else if (*s == '\0') /* According to the ISO C 89 standard this is the expected behaviour. Idiotic, but true. */ -- cgit v1.2.3-65-gdbad