Author: tridge Date: 2004-10-25 10:25:25 +0000 (Mon, 25 Oct 2004) New Revision: 3210
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/lib&rev=3210&nolog=1 Log: split lib/replace.o into a separate build subsystem LIBREPLACE, and make the ldb tools depend on it. This should help the build of the ldb tools on platforms without strnlen() or strndup() Modified: branches/SAMBA_4_0/source/lib/basic.m4 branches/SAMBA_4_0/source/lib/basic.mk branches/SAMBA_4_0/source/lib/ldb/config.mk branches/SAMBA_4_0/source/lib/replace.c branches/SAMBA_4_0/source/lib/util_str.c Changeset: Modified: branches/SAMBA_4_0/source/lib/basic.m4 =================================================================== --- branches/SAMBA_4_0/source/lib/basic.m4 2004-10-25 10:21:41 UTC (rev 3209) +++ branches/SAMBA_4_0/source/lib/basic.m4 2004-10-25 10:25:25 UTC (rev 3210) @@ -1,3 +1,4 @@ dnl # LIB BASIC subsystem +SMB_SUBSYSTEM_MK(LIBREPLACE,lib/basic.mk) SMB_SUBSYSTEM_MK(LIBBASIC,lib/basic.mk) Modified: branches/SAMBA_4_0/source/lib/basic.mk =================================================================== --- branches/SAMBA_4_0/source/lib/basic.mk 2004-10-25 10:21:41 UTC (rev 3209) +++ branches/SAMBA_4_0/source/lib/basic.mk 2004-10-25 10:25:25 UTC (rev 3210) @@ -1,6 +1,13 @@ # LIB BASIC subsystem ############################## +# Start SUBSYSTEM LIBREPLACE +[SUBSYSTEM::LIBREPLACE] +INIT_OBJ_FILES = lib/replace.o +# End SUBSYSTEM LIBREPLACE +############################## + +############################## # Start SUBSYSTEM LIBBASIC [SUBSYSTEM::LIBBASIC] INIT_OBJ_FILES = lib/version.o @@ -11,7 +18,6 @@ lib/interface.o \ lib/interfaces.o \ lib/pidfile.o \ - lib/replace.o \ lib/signal.o \ lib/system.o \ lib/time.o \ @@ -50,6 +56,6 @@ lib/server_mutex.o \ lib/idtree.o REQUIRED_SUBSYSTEMS = \ - LIBTDB CHARSET + LIBTDB CHARSET LIBREPLACE # End SUBSYSTEM LIBBASIC ############################## Modified: branches/SAMBA_4_0/source/lib/ldb/config.mk =================================================================== --- branches/SAMBA_4_0/source/lib/ldb/config.mk 2004-10-25 10:21:41 UTC (rev 3209) +++ branches/SAMBA_4_0/source/lib/ldb/config.mk 2004-10-25 10:25:25 UTC (rev 3210) @@ -37,6 +37,8 @@ lib/ldb/common/ldb_utf8.o \ lib/ldb/common/ldb_alloc.o \ lib/ldb/common/ldb_debug.o +REQUIRED_SUBSYSTEMS = \ + LIBREPLACE # # End SUBSYSTEM LIBLDB ################################################ Modified: branches/SAMBA_4_0/source/lib/replace.c =================================================================== --- branches/SAMBA_4_0/source/lib/replace.c 2004-10-25 10:21:41 UTC (rev 3209) +++ branches/SAMBA_4_0/source/lib/replace.c 2004-10-25 10:25:25 UTC (rev 3210) @@ -480,3 +480,36 @@ #endif } #endif + + +#ifndef HAVE_STRNDUP +/** + Some platforms don't have strndup. +**/ + char *strndup(const char *s, size_t n) +{ + char *ret; + + n = strnlen(s, n); + ret = malloc(n+1); + if (!ret) + return NULL; + memcpy(ret, s, n); + ret[n] = 0; + + return ret; +} +#endif + +#ifndef HAVE_STRNLEN +/** + Some platforms don't have strnlen +**/ + size_t strnlen(const char *s, size_t n) +{ + int i; + for (i=0; s[i] && i<n; i++) + /* noop */ ; + return i; +} +#endif Modified: branches/SAMBA_4_0/source/lib/util_str.c =================================================================== --- branches/SAMBA_4_0/source/lib/util_str.c 2004-10-25 10:21:41 UTC (rev 3209) +++ branches/SAMBA_4_0/source/lib/util_str.c 2004-10-25 10:25:25 UTC (rev 3210) @@ -872,40 +872,7 @@ return s; } -#ifndef HAVE_STRNDUP /** - Some platforms don't have strndup. -**/ - char *strndup(const char *s, size_t n) -{ - char *ret; - - n = strnlen(s, n); - ret = malloc(n+1); - if (!ret) - return NULL; - memcpy(ret, s, n); - ret[n] = 0; - - return ret; -} -#endif - -#ifndef HAVE_STRNLEN -/** - Some platforms don't have strnlen -**/ - size_t strnlen(const char *s, size_t n) -{ - int i; - for (i=0; s[i] && i<n; i++) - /* noop */ ; - return i; -} -#endif - - -/** Unescape a URL encoded string, in place. **/