summaryrefslogtreecommitdiff
path: root/source4/lib/util
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/util')
-rw-r--r--source4/lib/util/config.mk45
-rw-r--r--source4/lib/util/tests/file.c4
-rw-r--r--source4/lib/util/tests/str.c2
-rw-r--r--source4/lib/util/time.c2
-rw-r--r--source4/lib/util/time.h2
-rw-r--r--source4/lib/util/util.h2
6 files changed, 30 insertions, 27 deletions
diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk
index 0bf0692193..925713a53c 100644
--- a/source4/lib/util/config.mk
+++ b/source4/lib/util/config.mk
@@ -1,7 +1,11 @@
[SUBSYSTEM::LIBSAMBA-UTIL]
-#VERSION = 0.0.1
-#SO_VERSION = 0
-OBJ_FILES = xfile.o \
+PUBLIC_DEPENDENCIES = \
+ LIBTALLOC LIBCRYPTO \
+ SOCKET_WRAPPER LIBREPLACE_NETWORK \
+ CHARSET EXECINFO
+
+LIBSAMBA-UTIL_OBJ_FILES = $(addprefix $(libutilsrcdir)/, \
+ xfile.o \
debug.o \
fault.o \
signal.o \
@@ -19,13 +23,9 @@ OBJ_FILES = xfile.o \
mutex.o \
idtree.o \
become_daemon.o \
- params.o
-PUBLIC_DEPENDENCIES = \
- LIBTALLOC LIBCRYPTO \
- SOCKET_WRAPPER LIBREPLACE_NETWORK \
- CHARSET EXECINFO
+ params.o)
-PUBLIC_HEADERS += $(addprefix lib/util/, util.h \
+PUBLIC_HEADERS += $(addprefix $(libutilsrcdir)/, util.h \
attr.h \
byteorder.h \
data_blob.h \
@@ -37,32 +37,35 @@ PUBLIC_HEADERS += $(addprefix lib/util/, util.h \
xfile.h)
[SUBSYSTEM::ASN1_UTIL]
-PRIVATE_PROTO_HEADER = asn1_proto.h
-OBJ_FILES = asn1.o
-# PUBLIC_HEADERS += lib/util/asn1.h
+ASN1_UTIL_OBJ_FILES = $(libutilsrcdir)/asn1.o
+
+$(eval $(call proto_header_template,$(libutilsrcdir)/asn1_proto.h,$(ASN1_UTIL_OBJ_FILES:.o=.c)))
[SUBSYSTEM::UNIX_PRIVS]
-PRIVATE_PROTO_HEADER = unix_privs.h
-OBJ_FILES = unix_privs.o
+
+UNIX_PRIVS_OBJ_FILES = $(libutilsrcdir)/unix_privs.o
+
+$(eval $(call proto_header_template,$(libutilsrcdir)/unix_privs.h,$(UNIX_PRIVS_OBJ_FILES:.o=.c)))
################################################
# Start SUBSYSTEM WRAP_XATTR
[SUBSYSTEM::WRAP_XATTR]
-OBJ_FILES = \
- wrap_xattr.o
PUBLIC_DEPENDENCIES = XATTR
#
# End SUBSYSTEM WRAP_XATTR
################################################
+WRAP_XATTR_OBJ_FILES = $(libutilsrcdir)/wrap_xattr.o
+
[SUBSYSTEM::UTIL_TDB]
-PRIVATE_PROTO_HEADER = util_tdb.h
-OBJ_FILES = \
- util_tdb.o
PUBLIC_DEPENDENCIES = LIBTDB
+UTIL_TDB_OBJ_FILES = $(libutilsrcdir)/util_tdb.o
+
+$(eval $(call proto_header_template,$(libutilsrcdir)/util_tdb.h,$(UTIL_TDB_OBJ_FILES:.o=.c)))
+
[SUBSYSTEM::UTIL_LDB]
-OBJ_FILES = \
- util_ldb.o
PUBLIC_DEPENDENCIES = LIBLDB
+
+UTIL_LDB_OBJ_FILES = $(libutilsrcdir)/util_ldb.o
diff --git a/source4/lib/util/tests/file.c b/source4/lib/util/tests/file.c
index fe87293671..3377e833dc 100644
--- a/source4/lib/util/tests/file.c
+++ b/source4/lib/util/tests/file.c
@@ -45,9 +45,9 @@ static bool test_file_load_save(struct torture_context *tctx)
data = file_load(TEST_FILENAME, &len, mem_ctx);
torture_assert(tctx, data, "loading file");
- torture_assert(tctx, len == strlen(TEST_DATA), "Length");
+ torture_assert_int_equal(tctx, len, strlen(TEST_DATA), "Length");
- torture_assert(tctx, memcmp(data, TEST_DATA, len) == 0, "Contents");
+ torture_assert_mem_equal(tctx, data, TEST_DATA, len, "Contents");
unlink(TEST_FILENAME);
return true;
diff --git a/source4/lib/util/tests/str.c b/source4/lib/util/tests/str.c
index a219ef0891..3bd6a02fdc 100644
--- a/source4/lib/util/tests/str.c
+++ b/source4/lib/util/tests/str.c
@@ -20,7 +20,7 @@
*/
#include "includes.h"
-#include "torture/ui.h"
+#include "torture/torture.h"
static bool test_string_sub_simple(struct torture_context *tctx)
{
diff --git a/source4/lib/util/time.c b/source4/lib/util/time.c
index a181885806..978d73cc0a 100644
--- a/source4/lib/util/time.c
+++ b/source4/lib/util/time.c
@@ -376,7 +376,7 @@ _PUBLIC_ NTTIME pull_nttime(uint8_t *base, uint16_t offset)
/**
return (tv1 - tv2) in microseconds
*/
-_PUBLIC_ int64_t usec_time_diff(struct timeval *tv1, struct timeval *tv2)
+_PUBLIC_ int64_t usec_time_diff(const struct timeval *tv1, const struct timeval *tv2)
{
int64_t sec_diff = tv1->tv_sec - tv2->tv_sec;
return (sec_diff * 1000000) + (int64_t)(tv1->tv_usec - tv2->tv_usec);
diff --git a/source4/lib/util/time.h b/source4/lib/util/time.h
index 1ab976ca78..e4008c5782 100644
--- a/source4/lib/util/time.h
+++ b/source4/lib/util/time.h
@@ -127,7 +127,7 @@ _PUBLIC_ NTTIME nttime_from_string(const char *s);
/**
return (tv1 - tv2) in microseconds
*/
-_PUBLIC_ int64_t usec_time_diff(struct timeval *tv1, struct timeval *tv2);
+_PUBLIC_ int64_t usec_time_diff(const struct timeval *tv1, const struct timeval *tv2);
/**
return a zero timeval
diff --git a/source4/lib/util/util.h b/source4/lib/util/util.h
index 3bf6b98d2f..ffe83c14b2 100644
--- a/source4/lib/util/util.h
+++ b/source4/lib/util/util.h
@@ -64,7 +64,7 @@ extern const char *panic_action;
makes the return type safe.
*/
#ifndef discard_const
-#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
+#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
#endif
/** Type-safe version of discard_const */