summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/lib/basic.m41
-rw-r--r--source4/lib/basic.mk10
-rw-r--r--source4/lib/ldb/config.mk2
-rw-r--r--source4/lib/replace.c33
-rw-r--r--source4/lib/util_str.c33
5 files changed, 44 insertions, 35 deletions
diff --git a/source4/lib/basic.m4 b/source4/lib/basic.m4
index b233c842db..6701ddaee5 100644
--- a/source4/lib/basic.m4
+++ b/source4/lib/basic.m4
@@ -1,3 +1,4 @@
dnl # LIB BASIC subsystem
+SMB_SUBSYSTEM_MK(LIBREPLACE,lib/basic.mk)
SMB_SUBSYSTEM_MK(LIBBASIC,lib/basic.mk)
diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk
index 3baab26c5b..c7d3a264d2 100644
--- a/source4/lib/basic.mk
+++ b/source4/lib/basic.mk
@@ -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 @@ ADD_OBJ_FILES = \
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 @@ ADD_OBJ_FILES = \
lib/server_mutex.o \
lib/idtree.o
REQUIRED_SUBSYSTEMS = \
- LIBTDB CHARSET
+ LIBTDB CHARSET LIBREPLACE
# End SUBSYSTEM LIBBASIC
##############################
diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk
index 3b2501a83b..639652ea55 100644
--- a/source4/lib/ldb/config.mk
+++ b/source4/lib/ldb/config.mk
@@ -37,6 +37,8 @@ ADD_OBJ_FILES = \
lib/ldb/common/ldb_utf8.o \
lib/ldb/common/ldb_alloc.o \
lib/ldb/common/ldb_debug.o
+REQUIRED_SUBSYSTEMS = \
+ LIBREPLACE
#
# End SUBSYSTEM LIBLDB
################################################
diff --git a/source4/lib/replace.c b/source4/lib/replace.c
index 64234f7042..f3a0df6ef6 100644
--- a/source4/lib/replace.c
+++ b/source4/lib/replace.c
@@ -480,3 +480,36 @@ char *rep_inet_ntoa(struct in_addr ip)
#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
diff --git a/source4/lib/util_str.c b/source4/lib/util_str.c
index 07a2c1dbd1..95c0b84d98 100644
--- a/source4/lib/util_str.c
+++ b/source4/lib/util_str.c
@@ -872,39 +872,6 @@ char *binary_string(char *buf, int len)
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.
**/