summaryrefslogtreecommitdiff
path: root/source4/lib/tdb
diff options
context:
space:
mode:
authorDerrell Lipman <derrell@samba.org>2005-06-04 17:13:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:35 -0500
commita1ba224107fbcf6f8a9a3091f42cde2a0c47f85e (patch)
tree0d29cea6db75b6318f9645def992a7a840a369bf /source4/lib/tdb
parent5296bd1b5107f321de0dc9b3a9c3f6ac5a4861f0 (diff)
downloadsamba-a1ba224107fbcf6f8a9a3091f42cde2a0c47f85e.tar.gz
samba-a1ba224107fbcf6f8a9a3091f42cde2a0c47f85e.tar.bz2
samba-a1ba224107fbcf6f8a9a3091f42cde2a0c47f85e.zip
r7276: - moved static tdb function ltdb_dn_fold() into common/ so that it can be
called from multiple backends. (ldb_sqlite3 needs it too.) Added parameter for a callback function that determines whether an attribute needs case folding. - begin to prepare for sqlite3 in build process - work-in-progress updates, on ldb_sqlite3 (This used to be commit a80bced0b96ffb655559a43cf7f4d7a34deb5a7d)
Diffstat (limited to 'source4/lib/tdb')
-rw-r--r--source4/lib/tdb/common/tdb.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source4/lib/tdb/common/tdb.c b/source4/lib/tdb/common/tdb.c
index 670fdda7cd..e9cbc12b91 100644
--- a/source4/lib/tdb/common/tdb.c
+++ b/source4/lib/tdb/common/tdb.c
@@ -105,9 +105,18 @@
#define MAP_FAILED ((void *)-1)
#endif
+#ifndef discard_const_p
+# if defined(__intptr_t_defined) || defined(HAVE_INTPTR_T)
+# define discard_const(ptr) ((void *)((intptr_t)(ptr)))
+# else
+# define discard_const(ptr) ((void *)(ptr))
+# endif
+# define discard_const_p(type, ptr) ((type *)discard_const(ptr))
+#endif
+
/* free memory if the pointer is valid and zero the pointer */
#ifndef SAFE_FREE
-#define SAFE_FREE(x) do { if ((x) != NULL) {free((x)); (x)=NULL;} } while(0)
+#define SAFE_FREE(x) do { if ((x) != NULL) {free(discard_const_p(void *, (x))); (x)=NULL;} } while(0)
#endif
#define BUCKET(hash) ((hash) % tdb->header.hash_size)