diff options
author | Ralf Corsepius <ralf.corsepius@rtems.org> | 2007-06-12 07:06:16 +0000 |
---|---|---|
committer | Ralf Corsepius <ralf.corsepius@rtems.org> | 2007-06-12 07:06:16 +0000 |
commit | a81de3f92683e42658a7a782535af81eb1cb4585 (patch) | |
tree | 733ec7bf0a7e266ad5c451b8a81ea00f4896f193 /cpukit/shttpd | |
parent | 2007-06-12 Ralf Corsépius <ralf.corsepius@rtems.org> (diff) | |
download | rtems-a81de3f92683e42658a7a782535af81eb1cb4585.tar.bz2 |
Eliminate my_strdup, my_strndup.
Diffstat (limited to 'cpukit/shttpd')
-rw-r--r-- | cpukit/shttpd/defs.h | 11 | ||||
-rw-r--r-- | cpukit/shttpd/string.c | 4 |
2 files changed, 15 insertions, 0 deletions
diff --git a/cpukit/shttpd/defs.h b/cpukit/shttpd/defs.h index cca0057809..1f0c81b743 100644 --- a/cpukit/shttpd/defs.h +++ b/cpukit/shttpd/defs.h @@ -377,8 +377,19 @@ extern void log_access(FILE *fp, const struct conn *c); extern void my_strlcpy(register char *, register const char *, size_t); extern int my_strncasecmp(register const char *, register const char *, size_t); +#ifndef HAVE_STRNDUP extern char *my_strndup(const char *ptr, size_t len); +#else +#include <string.h> +#define my_strndup(x,l) strndup((x),(l)) +#endif + +#ifndef HAVE_STRDUP extern char *my_strdup(const char *str); +#else +#include <string.h> +#define my_strdup(x) strdup(x) +#endif extern int my_snprintf(char *buf, size_t buflen, const char *fmt, ...); /* diff --git a/cpukit/shttpd/string.c b/cpukit/shttpd/string.c index f1b3645bac..8e9023cf31 100644 --- a/cpukit/shttpd/string.c +++ b/cpukit/shttpd/string.c @@ -32,6 +32,7 @@ my_strncasecmp(const char *str1, const char *str2, size_t len) return (ret); } +#ifndef HAVE_STRNDUP char * my_strndup(const char *ptr, size_t len) { @@ -43,12 +44,15 @@ my_strndup(const char *ptr, size_t len) return (p); } +#endif +#ifndef HAVE_STRDUP char * my_strdup(const char *str) { return (my_strndup(str, strlen(str))); } +#endif /* * Sane snprintf(). Acts like snprintf(), but never return -1 or the |