svn commit: samba r17771 - in branches/SAMBA_4_0/source/lib/ldb/ldb_tdb: .

tridge at samba.org tridge at samba.org
Thu Aug 24 07:20:32 GMT 2006


Author: tridge
Date: 2006-08-24 07:20:32 +0000 (Thu, 24 Aug 2006)
New Revision: 17771

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17771

Log:

add a comment explaing the odd cast

Modified:
   branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c	2006-08-24 06:13:11 UTC (rev 17770)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c	2006-08-24 07:20:32 UTC (rev 17771)
@@ -61,6 +61,12 @@
 		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 */



More information about the samba-cvs mailing list