diff options
author | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-11-18 10:44:56 +0100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-11-20 12:26:37 +1100 |
commit | afb70f9176563e2d96886c086ec7d57bf78393b2 (patch) | |
tree | e03d7def258287bb32d4de338e9c148edcced0b9 /source4 | |
parent | dda28a9a787c31426f6d653dbdb5a0585b3dc25f (diff) | |
download | samba-afb70f9176563e2d96886c086ec7d57bf78393b2.tar.gz samba-afb70f9176563e2d96886c086ec7d57bf78393b2.tar.bz2 samba-afb70f9176563e2d96886c086ec7d57bf78393b2.zip |
ldb:ldb_tdb backend/indexes - DN comparison
- DN comparison: The function doesn't seem that efficient. I "upgraded" it a bit
to be more powerful (added a second length check and do both before the string
comparison)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_index.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c index 55c5c9c952..454dffbb61 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_index.c +++ b/source4/lib/ldb/ldb_tdb/ldb_index.c @@ -60,12 +60,13 @@ int ltdb_index_transaction_start(struct ldb_module *module) * differences in string termination */ static int dn_list_cmp(const struct ldb_val *v1, const struct ldb_val *v2) { - int ret = strncmp((char *)v1->data, (char *)v2->data, v1->length); - if (ret != 0) return ret; - if (v2->length > v1->length && v2->data[v1->length] != 0) { + if (v1->length > v2->length && v1->data[v2->length] != 0) { + return -1; + } + if (v1->length < v2->length && v2->data[v1->length] != 0) { return 1; } - return 0; + return strncmp((char *)v1->data, (char *)v2->data, v1->length); } |