diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-09-18 23:46:58 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:52:19 -0500 |
commit | ac76c1804c7e5627d4c4841ceb825b27c4e8b4d5 (patch) | |
tree | 3f0c14b520fc8d65c54dc019663765d49aba5f80 /source3/lib | |
parent | af61cbdae9aa5206e0344d88823ff5b50ef80777 (diff) | |
download | samba-ac76c1804c7e5627d4c4841ceb825b27c4e8b4d5.tar.gz samba-ac76c1804c7e5627d4c4841ceb825b27c4e8b4d5.tar.bz2 samba-ac76c1804c7e5627d4c4841ceb825b27c4e8b4d5.zip |
r18652: libreplace has replacements for strndup and strnlen
metze
(This used to be commit 9f3599a7ca636dd21c150873f395abde153ee6fd)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util_str.c | 43 |
1 files changed, 0 insertions, 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<n && s[i] != '\0'; i++) - /* noop */ ; - return i; -} -#endif - /** List of Strings manipulation functions **/ |