From ac76c1804c7e5627d4c4841ceb825b27c4e8b4d5 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 18 Sep 2006 23:46:58 +0000 Subject: r18652: libreplace has replacements for strndup and strnlen metze (This used to be commit 9f3599a7ca636dd21c150873f395abde153ee6fd) --- source3/lib/util_str.c | 43 ------------------------------------------- 1 file changed, 43 deletions(-) diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 8639a9bc07..4619d47388 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -1663,49 +1663,6 @@ int fstr_sprintf(fstring s, const char *fmt, ...) return ret; } - -#if !defined(HAVE_STRNDUP) || defined(BROKEN_STRNDUP) -/** - Some platforms don't have strndup. -**/ -#if defined(PARANOID_MALLOC_CHECKER) -#undef strndup -#endif - - char *strndup(const char *s, size_t n) -{ - char *ret; - - n = strnlen(s, n); - ret = SMB_MALLOC(n+1); - if (!ret) - return NULL; - memcpy(ret, s, n); - ret[n] = 0; - - return ret; -} - -#if defined(PARANOID_MALLOC_CHECKER) -#define strndup(s,n) __ERROR_DONT_USE_STRNDUP_DIRECTLY -#endif - -#endif - -#if !defined(HAVE_STRNLEN) || defined(BROKEN_STRNLEN) -/** - Some platforms don't have strnlen -**/ - - size_t strnlen(const char *s, size_t n) -{ - size_t i; - for (i=0; i