diff options
author | Andrew Tridgell <tridge@samba.org> | 2006-08-24 07:20:32 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:16:39 -0500 |
commit | 66337169f13592c85b15d18115893f5c8a53f866 (patch) | |
tree | c624fdd7c9eb246aa63206d2308f3080c16ea09e /source4/lib/ldb | |
parent | a524e8cdded5c0975583d7db97de8c61d95b670c (diff) | |
download | samba-66337169f13592c85b15d18115893f5c8a53f866.tar.gz samba-66337169f13592c85b15d18115893f5c8a53f866.tar.bz2 samba-66337169f13592c85b15d18115893f5c8a53f866.zip |
r17771: add a comment explaing the odd cast
(This used to be commit 47e695ed88d364a7d423e804fe5340006ebf7c18)
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_index.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c index c6feeaeb42..b628c31b09 100644 --- 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 */ |