tdb: simplify tdb_delete_hash() a bit
authorMichael Adam <obnox@samba.org>
Thu, 13 Feb 2014 15:48:35 +0000 (16:48 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 14 Feb 2014 23:55:46 +0000 (15:55 -0800)
commitcde8e290c9195cbc7a2388455df9e76a1f36135f
tree5ba28ee33ff3139a33bbcafc9d9561281e92194d
parentadb2cd1eee69550fa58d8cb11441b7174dccae5b
tdb: simplify tdb_delete_hash() a bit

Make the lock/unlock bracket more obvious by extracting
locking (and finding) from the special cases to the top
of the function. This also lets us take lock and find
the record outside the special case branches (use dead
records or not).

There is a small semantic change implied:

In the dead records case, the record to delete is looked
up before the current dead records are potentially purged.
Hence, if the record to delete is not found, the dead
records are also not purge. This does not make a big
difference though, because purging is only delayed until
directly befor the next record to delete is in fact found.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/tdb/common/tdb.c