]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Wed, 29 Apr 1998 13:05:07 +0000 (13:05 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 29 Apr 1998 13:05:07 +0000 (13:05 +0000)
* wcsmbs/mbsrtowcs.c: Optimize a bit more.
* wcsmbs/wcsrtombs.c: Likewise.

ChangeLog
wcsmbs/mbsnrtowcs.c
wcsmbs/mbsrtowcs.c
wcsmbs/wcsnrtombs.c
wcsmbs/wcsrtombs.c

index c8c4a1efcce568134f03b7665b6a12ffb85b1d1b..78adbee5bc1ab901d3b848b19e933e22da46980e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,9 @@
        it is not used.
        * wcsmbs/wctoc.c: Likewise.
 
+       * wcsmbs/mbsrtowcs.c: Optimize a bit more.
+       * wcsmbs/wcsrtombs.c: Likewise.
+
 1998-04-29  Ulrich Drepper  <drepper@cygnus.com>
 
        * iconv/skeleton.c: Correct counting of actually converted
index 790e777a6c57fdbaaf90cbe0bbb1b4b38ab98a4c..a73fcd1e98072d9f5091a4a073a54b97b8707acd 100644 (file)
@@ -66,12 +66,15 @@ __mbsnrtowcs (dst, src, nmc, len, ps)
       wchar_t buf[64];         /* Just an arbitrary size.  */
       const char *inbuf = *src;
 
-      data.outbuf = (char *) buf;
       data.outbufend = data.outbuf + sizeof (buf);
       do
-       status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
-                                                  &data, &inbuf, srcend,
-                                                  &result, 0);
+       {
+         data.outbuf = (char *) buf;
+
+         status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
+                                                    &data, &inbuf, srcend,
+                                                    &result, 0);
+       }
       while (status == GCONV_FULL_OUTPUT);
 
       if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT)
index 5043fd146e82ab95b229623e39e75432aa6d5eef..bad27bab986a3ad3195c14e7530cdab48c0568a1 100644 (file)
@@ -59,18 +59,24 @@ __mbsrtowcs (dst, src, len, ps)
       const char *srcend = *src + strlen (*src) + 1;
       const char *inbuf = *src;
 
-      data.outbuf = (char *) buf;
       data.outbufend = data.outbuf + sizeof (buf);
       do
-       status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
-                                                  &data, &inbuf, srcend,
-                                                  &result, 0);
+       {
+         data.outbuf = (char *) buf;
+
+         status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
+                                                    &data, &inbuf, srcend,
+                                                    &result, 0);
+       }
       while (status == GCONV_FULL_OUTPUT);
 
-      if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT)
-         && ((wchar_t *) data.outbuf)[-1] == L'\0')
-       /* Don't count the NUL character in.  */
-       --result;
+      if (status == GCONV_OK || status == GCONV_EMPTY_INPUT)
+       {
+         /* There better should be a NUL wide char at the end.  */
+         assert (((wchar_t *) data.outbuf)[-1] == L'\0');
+         /* Don't count the NUL character in.  */
+         --result;
+       }
     }
   else
     {
index 815d7addb570553e12ab89ad29013cf8465e6066..eb4a96daad2a9c750b3ba66eac0915f64df1ae8e 100644 (file)
@@ -65,15 +65,18 @@ __wcsnrtombs (dst, src, nwc, len, ps)
       char buf[256];           /* Just an arbitrary value.  */
       const wchar_t *inbuf = *src;
 
-      data.outbuf = buf;
       data.outbufend = buf + sizeof (buf);
 
       do
-       status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
-                                                  &data,
-                                                  (const char **) &inbuf,
-                                                  (const char *) srcend,
-                                                  &result, 0);
+       {
+         data.outbuf = buf;
+
+         status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
+                                                    &data,
+                                                    (const char **) &inbuf,
+                                                    (const char *) srcend,
+                                                    &result, 0);
+       }
       while (status == GCONV_FULL_OUTPUT);
 
       if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT)
index ba2d8dc3e214b1a263a177b555e5b2e03f09def2..27b1df8f6d9a4e4c61d0d99816e0eb3cbf23874c 100644 (file)
@@ -58,21 +58,27 @@ __wcsrtombs (dst, src, len, ps)
       const wchar_t *srcend = *src + __wcslen (*src) + 1;
       const wchar_t *inbuf = *src;
 
-      data.outbuf = buf;
       data.outbufend = buf + sizeof (buf);
 
       do
-       status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
-                                                  &data,
-                                                  (const char **) &inbuf,
-                                                  (const char *) srcend,
-                                                  &result, 0);
+       {
+         data.outbuf = buf;
+
+         status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
+                                                    &data,
+                                                    (const char **) &inbuf,
+                                                    (const char *) srcend,
+                                                    &result, 0);
+       }
       while (status == GCONV_FULL_OUTPUT);
 
-      if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT)
-         && data.outbuf[-1] == '\0')
-       /* Don't count the NUL character in.  */
-       --result;
+      if (status == GCONV_OK || status == GCONV_EMPTY_INPUT)
+       {
+         /* There better should be a NUL byte at the end.  */
+         assert (data.outbuf[-1] == '\0');
+         /* Don't count the NUL character in.  */
+         --result;
+       }
     }
   else
     {