]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Fix portability problem on Solaris 2.5.1.
authorBruno Haible <bruno@clisp.org>
Tue, 12 Aug 2003 17:43:43 +0000 (17:43 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:10:49 +0000 (12:10 +0200)
gettext-runtime/intl/ChangeLog
gettext-runtime/intl/vasnprintf.c
gettext-runtime/libasprintf/ChangeLog
gettext-runtime/libasprintf/vasnprintf.c

index fd06b4ed73abc4389e1aab659a68be294bc36f34..92485dce3389e683ddc00a0c198017f0b390b1fa 100644 (file)
@@ -1,3 +1,8 @@
+2003-08-11  Bruno Haible  <bruno@clisp.org>
+
+       * vasnprintf.c (local_wcslen): New function, for Solaris 2.5.1.
+       (VASNPRINTF): Use it instead of wcslen.
+
 2003-08-01  Bruno Haible  <bruno@clisp.org>
 
        * relocatable.c (find_shared_library_fullname): Disable the code on
index b94297d1e7eefa692038e8740681850da4ff153c..6d2c768fd7e609c2e0616b81eccc4ffff226dc02 100644 (file)
 # define freea(p) free (p)
 #endif
 
+#ifdef HAVE_WCHAR_T
+# ifdef HAVE_WCSLEN
+#  define local_wcslen wcslen
+# else
+   /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid
+      a dependency towards this library, here is a local substitute.  */
+static size_t
+local_wcslen (const wchar_t *s)
+{
+  const wchar_t *ptr;
+
+  for (ptr = s; *ptr != (wchar_t) 0; ptr++)
+    ;
+  return ptr - s;
+}
+# endif
+#endif
+
 #if WIDE_CHAR_VERSION
 # define VASNPRINTF vasnwprintf
 # define CHAR_T wchar_t
@@ -399,10 +417,10 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
                      if (type == TYPE_WIDE_STRING)
 #  if WIDE_CHAR_VERSION
                        tmp_length =
-                         wcslen (a.arg[dp->arg_index].a.a_wide_string);
+                         local_wcslen (a.arg[dp->arg_index].a.a_wide_string);
 #  else
                        tmp_length =
-                         wcslen (a.arg[dp->arg_index].a.a_wide_string)
+                         local_wcslen (a.arg[dp->arg_index].a.a_wide_string)
                          * MB_CUR_MAX;
 #  endif
                      else
index e2e0943e81904bba25e4037ed4c69fc01a60af45..1dd9226ed8726884a784fc42255b04c17ec248e4 100644 (file)
@@ -1,3 +1,8 @@
+2003-08-11  Bruno Haible  <bruno@clisp.org>
+
+       * vasnprintf.c (local_wcslen): New function, for Solaris 2.5.1.
+       (VASNPRINTF): Use it instead of wcslen.
+
 2003-06-20  Bruno Haible  <bruno@clisp.org>
 
        * configure.ac: Invoke gt_PRINTF_POSIX.
index b94297d1e7eefa692038e8740681850da4ff153c..6d2c768fd7e609c2e0616b81eccc4ffff226dc02 100644 (file)
 # define freea(p) free (p)
 #endif
 
+#ifdef HAVE_WCHAR_T
+# ifdef HAVE_WCSLEN
+#  define local_wcslen wcslen
+# else
+   /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid
+      a dependency towards this library, here is a local substitute.  */
+static size_t
+local_wcslen (const wchar_t *s)
+{
+  const wchar_t *ptr;
+
+  for (ptr = s; *ptr != (wchar_t) 0; ptr++)
+    ;
+  return ptr - s;
+}
+# endif
+#endif
+
 #if WIDE_CHAR_VERSION
 # define VASNPRINTF vasnwprintf
 # define CHAR_T wchar_t
@@ -399,10 +417,10 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
                      if (type == TYPE_WIDE_STRING)
 #  if WIDE_CHAR_VERSION
                        tmp_length =
-                         wcslen (a.arg[dp->arg_index].a.a_wide_string);
+                         local_wcslen (a.arg[dp->arg_index].a.a_wide_string);
 #  else
                        tmp_length =
-                         wcslen (a.arg[dp->arg_index].a.a_wide_string)
+                         local_wcslen (a.arg[dp->arg_index].a.a_wide_string)
                          * MB_CUR_MAX;
 #  endif
                      else