bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

striconv, striconveh, unicodeio: Drop workaround for glibc 2.1


From: Bruno Haible
Subject: striconv, striconveh, unicodeio: Drop workaround for glibc 2.1
Date: Mon, 09 Sep 2024 16:06:16 +0200

And more of the same kind. Solaris 9's successor, Solaris 10, was released
in 2005. Solaris 9 workarounds therefore can also be dropped.


2024-09-09  Bruno Haible  <bruno@clisp.org>

        striconv, striconveh, unicodeio: Drop workaround for glibc 2.1.
        * lib/striconv.c (mem_cd_iconv, str_iconv): Remove glibc-2.1 and
        Solaris 9 bug workarounds.
        * lib/striconveh.c (mem_cd_iconveh_internal): Likewise.
        * lib/unicodeio.c (unicode_to_mb): Likewise.

diff --git a/lib/striconv.c b/lib/striconv.c
index 74aa969738..712a244ac7 100644
--- a/lib/striconv.c
+++ b/lib/striconv.c
@@ -47,13 +47,8 @@ mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
   size_t length;
   char *result;
 
-  /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug.  */
-# if defined _LIBICONV_VERSION \
-     || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
-          || defined __sun)
   /* Set to the initial state.  */
   iconv (cd, NULL, NULL, NULL, NULL);
-# endif
 
   /* Determine the length we need.  */
   {
@@ -96,10 +91,6 @@ mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
 # endif
         count += outptr - tmpbuf;
       }
-    /* Avoid glibc-2.1 bug and Solaris 2.7 bug.  */
-# if defined _LIBICONV_VERSION \
-     || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
-          || defined __sun)
     {
       char *outptr = tmpbuf;
       size_t outsize = tmpbufsize;
@@ -109,7 +100,6 @@ mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
         return -1;
       count += outptr - tmpbuf;
     }
-# endif
     length = count;
 # undef tmpbuf
   }
@@ -131,13 +121,8 @@ mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
         }
     }
 
-  /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug.  */
-# if defined _LIBICONV_VERSION \
-     || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
-          || defined __sun)
   /* Return to the initial state.  */
   iconv (cd, NULL, NULL, NULL, NULL);
-# endif
 
   /* Do the conversion for real.  */
   {
@@ -172,17 +157,12 @@ mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
           }
 # endif
       }
-    /* Avoid glibc-2.1 bug and Solaris 2.7 bug.  */
-# if defined _LIBICONV_VERSION \
-     || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
-          || defined __sun)
     {
       size_t res = iconv (cd, NULL, NULL, &outptr, &outsize);
 
       if (res == (size_t)(-1))
         goto fail;
     }
-# endif
     if (outsize != 0)
       abort ();
   }
@@ -273,13 +253,8 @@ str_cd_iconv (const char *src, iconv_t cd)
       return NULL;
     }
 
-  /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug.  */
-# if defined _LIBICONV_VERSION \
-     || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
-          || defined __sun)
   /* Set to the initial state.  */
   iconv (cd, NULL, NULL, NULL, NULL);
-# endif
 
   /* Do the conversion.  */
   {
@@ -326,10 +301,6 @@ str_cd_iconv (const char *src, iconv_t cd)
         else
           break;
       }
-    /* Avoid glibc-2.1 bug and Solaris 2.7 bug.  */
-# if defined _LIBICONV_VERSION \
-     || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
-          || defined __sun)
     for (;;)
       {
         /* Here outptr + outbytes_remaining = result + result_size - 1.  */
@@ -365,7 +336,6 @@ str_cd_iconv (const char *src, iconv_t cd)
         else
           break;
       }
-# endif
 
     /* Add the terminating NUL byte.  */
     *outptr++ = '\0';
diff --git a/lib/striconveh.c b/lib/striconveh.c
index 64cf1a1efd..952754ba5c 100644
--- a/lib/striconveh.c
+++ b/lib/striconveh.c
@@ -395,13 +395,8 @@ mem_cd_iconveh_internal (const char *src, size_t srclen,
     const char *inptr = src;
     size_t insize = srclen;
 
-    /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug.  */
-# if defined _LIBICONV_VERSION \
-     || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
-          || defined __sun)
     /* Set to the initial state.  */
     iconv (cd, NULL, NULL, NULL, NULL);
-# endif
 
     while (insize > 0)
       {
@@ -608,16 +603,11 @@ mem_cd_iconveh_internal (const char *src, size_t srclen,
     bool do_final_flush1 = true;
     bool do_final_flush2 = true;
 
-    /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug.  */
-# if defined _LIBICONV_VERSION \
-     || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
-          || defined __sun)
     /* Set to the initial state.  */
     if (cd1 != (iconv_t)(-1))
       iconv (cd1, NULL, NULL, NULL, NULL);
     if (cd2 != (iconv_t)(-1))
       iconv (cd2, NULL, NULL, NULL, NULL);
-# endif
 
     while (in1size > 0 || do_final_flush1 || utf8len > 0 || do_final_flush2)
       {
diff --git a/lib/unicodeio.c b/lib/unicodeio.c
index 9ed3875f93..e93f86ecba 100644
--- a/lib/unicodeio.c
+++ b/lib/unicodeio.c
@@ -154,17 +154,10 @@ unicode_to_mb (unsigned int code,
          )
         return failure (code, NULL, callback_arg);
 
-      /* Avoid glibc-2.1 bug and Solaris 7 bug.  */
-# if defined _LIBICONV_VERSION \
-    || !(((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) \
-          && !defined __UCLIBC__) \
-         || defined __sun)
-
       /* Get back to the initial shift state.  */
       res = iconv (utf8_to_local, NULL, NULL, &outptr, &outbytesleft);
       if (res == (size_t)(-1))
         return failure (code, NULL, callback_arg);
-# endif
 
       return success (outbuf, outptr - outbuf, callback_arg);
     }






reply via email to

[Prev in Thread] Current Thread [Next in Thread]