Add HAVE_STRNDUP and supporting structure to config.h and make utils.[ch] reflect it.

svn path=/trunk/netsurf/; revision=3351
This commit is contained in:
Rob Kendrick 2007-06-16 23:30:47 +00:00
parent 43257a160b
commit 36ecbc6be2
3 changed files with 13 additions and 6 deletions

View File

@ -9,7 +9,18 @@
#ifndef _NETSURF_UTILS_CONFIG_H_
#define _NETSURF_UTILS_CONFIG_H_
/* This file toggles build options on and off.
/* Try to detect which features the target OS supports */
#define HAVE_STRNDUP
#if defined(__FreeBSD__) || (defined(__SRV4) && defined(__sun))
/* FreeBSD and Solaris do not have this function, so
* we implement it ourselves in util.c
*/
#undef HAVE_STRNDUP
char *strndup(const char *s, size_t n);
#endif
/* This section toggles build options on and off.
* Simply undefine a symbol to turn the relevant feature off.
*
* IF ADDING A FEATURE HERE, ADD IT TO Docs/Doxyfile LINE 892 AS WELL.

View File

@ -257,7 +257,7 @@ unsigned int wallclock(void)
}
#if defined(__FreeBSD__) || (defined(__SVR4) && defined(__sun))
#ifndef HAVE_STRNDUP
/**
* Duplicate up to n characters of a string.

View File

@ -59,10 +59,6 @@ const char *rfc1123_date(time_t t);
char *strcasestr(const char *haystack, const char *needle);
#endif
unsigned int wallclock(void);
#ifdef __FreeBSD__
/* FreeBSD lacks strndup */
char *strndup(const char *s, size_t n);
#endif
/* Platform specific functions */
void die(const char * const error);