git.samba.org
/
abartlet
/
samba.git
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a524e8c
)
r17771: add a comment explaing the odd cast
author
Andrew Tridgell
<tridge@samba.org>
Thu, 24 Aug 2006 07:20:32 +0000
(07:20 +0000)
committer
Gerald (Jerry) Carter
<jerry@samba.org>
Wed, 10 Oct 2007 19:16:39 +0000
(14:16 -0500)
(This used to be commit
47e695ed88d364a7d423e804fe5340006ebf7c18
)
source4/lib/ldb/ldb_tdb/ldb_index.c
patch
|
blob
|
history
diff --git
a/source4/lib/ldb/ldb_tdb/ldb_index.c
b/source4/lib/ldb/ldb_tdb/ldb_index.c
index c6feeaeb42b96f26706f95089d5fbf5cca69598b..b628c31b095d2c19d159310f9c29146e8bd74e32 100644
(file)
--- a/
source4/lib/ldb/ldb_tdb/ldb_index.c
+++ b/
source4/lib/ldb/ldb_tdb/ldb_index.c
@@
-61,6
+61,12
@@
static int ldb_list_find(const void *needle,
int r;
test_i = (min_i + max_i) / 2;
+ /* the following cast looks strange, but is
+ correct. The key to understanding it is that base_p
+ is a pointer to an array of pointers, so we have to
+ dereference it after casting to void **. The strange
+ const in the middle gives us the right type of pointer
+ after the dereference (tridge) */
r = comp_fn(needle, *(void * const *)(base_p + (size * test_i)));
if (r == 0) {
/* scan back for first element */