Ticket #2234: glib2-wcslen-darwin6.patch

File glib2-wcslen-darwin6.patch, 1.2 KB (added by namely_void@…, 20 years ago)

make glib2 build on Mac OS X 10.2.8 (darwin 6)

  • glib/gnulib/vasnprintf.c

    old new  
    4141#include <float.h>      /* DBL_MAX_EXP, LDBL_MAX_EXP */
    4242#include "printf-parse.h"
    4343
     44#ifdef HAVE_WCHAR_T
     45# ifdef HAVE_WCSLEN
     46#  define local_wcslen wcslen
     47# else
     48   /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid
     49      a dependency towards this library, here is a local substitute.
     50      Define this substitute only once, even if this file is included
     51      twice in the same compilation unit.  */
     52#  ifndef local_wcslen_defined
     53#   define local_wcslen_defined 1
     54static size_t
     55local_wcslen (const wchar_t *s)
     56{
     57  const wchar_t *ptr;
     58
     59  for (ptr = s; *ptr != (wchar_t) 0; ptr++)
     60    ;
     61  return ptr - s;
     62}
     63#  endif
     64# endif
     65#endif
     66
    4467/* For those losing systems which don't have 'alloca' we have to add
    4568   some additional code emulating it.  */
    4669#ifdef HAVE_ALLOCA
     
    539562# ifdef HAVE_WCHAR_T
    540563                      if (type == TYPE_WIDE_STRING)
    541564                        tmp_length =
    542                           wcslen (a.arg[dp->arg_index].a.a_wide_string)
     565                          local_wcslen (a.arg[dp->arg_index].a.a_wide_string)
    543566                          * MB_CUR_MAX;
    544567                      else
    545568# endif