svn commit: samba r18652 - in branches/SAMBA_3_0/source/lib: .
metze at samba.org
metze at samba.org
Mon Sep 18 23:47:00 GMT 2006
Author: metze
Date: 2006-09-18 23:46:58 +0000 (Mon, 18 Sep 2006)
New Revision: 18652
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18652
Log:
libreplace has replacements for strndup and strnlen
metze
Modified:
branches/SAMBA_3_0/source/lib/util_str.c
Changeset:
Modified: branches/SAMBA_3_0/source/lib/util_str.c
===================================================================
--- branches/SAMBA_3_0/source/lib/util_str.c 2006-09-18 23:28:46 UTC (rev 18651)
+++ branches/SAMBA_3_0/source/lib/util_str.c 2006-09-18 23:46:58 UTC (rev 18652)
@@ -1663,50 +1663,7 @@
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
**/
More information about the samba-cvs
mailing list