summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb/ldb_match.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-05-06 04:40:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:51:45 -0500
commitd8ce7c6a2acbf371509a23775470e7614bcb6027 (patch)
tree3b0d2157dc855a17a6e7f0ace37cddfb60dfdb04 /source4/lib/ldb/ldb_tdb/ldb_match.c
parent3aa278b873c5d06a279e0e65a96d6e6b42b64583 (diff)
downloadsamba-d8ce7c6a2acbf371509a23775470e7614bcb6027.tar.gz
samba-d8ce7c6a2acbf371509a23775470e7614bcb6027.tar.bz2
samba-d8ce7c6a2acbf371509a23775470e7614bcb6027.zip
r502: modified ldb to allow the use of an external pool memory
allocator. The way to use this is to call ldb_set_alloc() with a function pointer to whatever memory allocator you like. It includes a context pointer to allow for pool based allocators. (This used to be commit 3955c482e6c2c9e975a4bb809ec8cb6068e48e34)
Diffstat (limited to 'source4/lib/ldb/ldb_tdb/ldb_match.c')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_match.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_match.c b/source4/lib/ldb/ldb_tdb/ldb_match.c
index 26e0eebfe7..80d147cb43 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_match.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_match.c
@@ -71,7 +71,8 @@ static int ldb_val_equal_case_insensitive(const struct ldb_val *v1,
and case insensitive
return 1 for a match, 0 for a mis-match
*/
-static int ldb_val_equal_wildcard_ci(const struct ldb_val *v1,
+static int ldb_val_equal_wildcard_ci(struct ldb_context *ldb,
+ const struct ldb_val *v1,
const struct ldb_val *v2)
{
char *s1, *s2;
@@ -81,20 +82,20 @@ static int ldb_val_equal_wildcard_ci(const struct ldb_val *v1,
return v1->data == v2->data;
}
- s1 = ldb_casefold(v1->data);
+ s1 = ldb_casefold(ldb, v1->data);
if (!s1) {
return -1;
}
- s2 = ldb_casefold(v2->data);
+ s2 = ldb_casefold(ldb, v2->data);
if (!s2) {
return -1;
}
ret = fnmatch(s2, s1, 0);
- free(s1);
- free(s2);
+ ldb_free(ldb, s1);
+ ldb_free(ldb, s2);
if (ret == 0) {
return 1;
@@ -107,12 +108,13 @@ static int ldb_val_equal_wildcard_ci(const struct ldb_val *v1,
see if two ldb_val structures contain the same data with wildcards
return 1 for a match, 0 for a mis-match
*/
-static int ldb_val_equal_wildcard(const struct ldb_val *v1,
+static int ldb_val_equal_wildcard(struct ldb_context *ldb,
+ const struct ldb_val *v1,
const struct ldb_val *v2,
int flags)
{
if (flags & LTDB_FLAG_CASE_INSENSITIVE) {
- return ldb_val_equal_wildcard_ci(v1, v2);
+ return ldb_val_equal_wildcard_ci(ldb, v1, v2);
}
if (!v1->data || !v2->data) {
return v1->data == v2->data;
@@ -182,7 +184,7 @@ int ldb_val_equal(struct ldb_context *ldb,
}
if (flags & LTDB_FLAG_WILDCARD) {
- return ldb_val_equal_wildcard(v1, v2, flags);
+ return ldb_val_equal_wildcard(ldb, v1, v2, flags);
}
if (flags & LTDB_FLAG_CASE_INSENSITIVE) {