Re: warnings important?



    > I'm not sure about this.  I expect `XmHTMLfuncs.h' to define an
    > useful `strdup', but why does it define it in the first place?
    > I don't think this warning needs alarm us too much, though.

Here is the relevant code from the include file:

/* We need the memory allocation functions for inline strdup().
   Referring to stdlib.h (even minimally) is not allowed
   in any of the tight standards compliant modes.  */
#ifdef __USE_MISC

# if !defined _HAVE_STRING_ARCH_strdup || !defined _HAVE_STRING_ARCH_strndup
#  define __need_malloc_and_calloc
#  include <stdlib.h>
# endif

# ifndef _HAVE_STRING_ARCH_strdup

#  define __strdup(s) \
  (__extension__ (__builtin_constant_p (s) && __string2_1bptr_p (s)           \
                  ? (((__const char *) (s))[0] == '\0'                        \
                     ? (char *) calloc (1, 1)                                 \
                     : ({ size_t __len = strlen (s) + 1;                      \
                          char *__retval = (char *) malloc (__len);           \
                          if (__retval != NULL)                               \
                            __retval = (char *) memcpy (__retval, s, __len);  \
                          __retval; }))                                       \
                  : __strdup (s)))

#  if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
#   define strdup(s) __strdup (s)
#  endif
# endif

-- 
Michael D. Harnois, Redeemer Lutheran Church, Washburn, IA 
mharnois@willinet.net                      aa0bt@aa0bt.ampr.org 
 Never, "for the sake of peace and quiet," deny your own 
 experience or convictions. -- Dag Hammarskjold



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