tdb_delete used as traversal function

Esh, Andrew AEsh at tricord.com
Thu Jan 3 13:36:01 GMT 2002


Speaking from the standpoint of my C experience (I am not familiar with this
specific code):

Yes, the more obvious do_delete_fn function should be used.

The current code is correct, however. The extra arguments will only consume
some extra stack space, and will then be cleaned up when tdb_delete exits,
and the stack frame is popped off.

The current code will perform slightly better than do_delete_fn, however.

-----Original Message-----
From: andreas moroder [mailto:claudiamoroder at st-ulrich.suedtirol.net]
Sent: Thursday, January 03, 2002 3:19 PM
To: samba-technical at lists.samba.org
Subject: tdb_delete used as traversal function


Hello,

in the following files

./groupdb/mapping.c
./lib/account_pol.c:		
./intl/lang_tdb.c:	
./printing/nt_printing.c:
./printing/printing.c:
./rpc_server/srv_srvsvc_nt.c:        

tdb_delete is used as paramter to tdb_traverse

but tdb_delete has only two parameters 

int tdb_delete(TDB_CONTEXT *tdb, TDB_DATA key)


while tdb_traverse passes 4 of them

if (fn && fn(tdb, key, dbuf, state)) 

Should not 

static int do_delete_fn(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf,
                     void *state)
{
    return tdb_delete(the_tdb, key);
}

in tdb/tdbtool.c be used instead ? 


Bye

Andreas

P.S. The comment before tdb_traverse is also wrong, it forgets the paramter 
state.

-------------- next part --------------
HTML attachment scrubbed and removed


More information about the samba-technical mailing list