Remove variable to pass to conversion function by letting the later
authordrepper <drepper>
Wed, 29 Apr 1998 12:14:34 +0000 (12:14 +0000)
committerdrepper <drepper>
Wed, 29 Apr 1998 12:14:34 +0000 (12:14 +0000)
modify the variable computing the total directly.

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

index 46a718b..790e777 100644 (file)
@@ -65,21 +65,17 @@ __mbsnrtowcs (dst, src, nmc, len, ps)
     {
       wchar_t buf[64];         /* Just an arbitrary size.  */
       const char *inbuf = *src;
-      size_t written;
 
       data.outbuf = (char *) buf;
       data.outbufend = data.outbuf + sizeof (buf);
       do
-       {
-         status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
-                                                    &data, &inbuf, srcend,
-                                                    &written, 0);
-         result += written;
-       }
+       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)
-         && buf[written - 1] == L'\0')
+         && ((wchar_t *) data.outbuf)[-1] == L'\0')
        /* Don't count the NUL character in.  */
        --result;
     }
index 9172fd9..5043fd1 100644 (file)
@@ -58,21 +58,17 @@ __mbsrtowcs (dst, src, len, ps)
       wchar_t buf[64];         /* Just an arbitrary size.  */
       const char *srcend = *src + strlen (*src) + 1;
       const char *inbuf = *src;
-      size_t written;
 
       data.outbuf = (char *) buf;
       data.outbufend = data.outbuf + sizeof (buf);
       do
-       {
-         status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
-                                                    &data, &inbuf, srcend,
-                                                    &written, 0);
-         result += written;
-       }
+       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)
-         && buf[written - 1] == L'\0')
+         && ((wchar_t *) data.outbuf)[-1] == L'\0')
        /* Don't count the NUL character in.  */
        --result;
     }
index 37b525b..815d7ad 100644 (file)
@@ -64,20 +64,16 @@ __wcsnrtombs (dst, src, nwc, len, ps)
     {
       char buf[256];           /* Just an arbitrary value.  */
       const wchar_t *inbuf = *src;
-      size_t written;
 
       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,
-                                                    &written, 0);
-         result += written;
-       }
+       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 b055a09..ba2d8dc 100644 (file)
@@ -57,20 +57,16 @@ __wcsrtombs (dst, src, len, ps)
       char buf[256];           /* Just an arbitrary value.  */
       const wchar_t *srcend = *src + __wcslen (*src) + 1;
       const wchar_t *inbuf = *src;
-      size_t written;
 
       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,
-                                                    &written, 0);
-         result += written;
-       }
+       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)