summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2010-12-21 11:22:50 +0100
committerMichael Adam <obnox@samba.org>2011-03-14 13:35:47 +0100
commit08ab829f0ba6a342b2e8c6a5e1a904ad2782ccf4 (patch)
tree7cedccdbfd31ed92890e9183ccb3bfdb74ae5acb
parent6a1857ee70149c18b68131476e08701ab2f4fa35 (diff)
downloadsamba-08ab829f0ba6a342b2e8c6a5e1a904ad2782ccf4.tar.gz
samba-08ab829f0ba6a342b2e8c6a5e1a904ad2782ccf4.tar.xz
samba-08ab829f0ba6a342b2e8c6a5e1a904ad2782ccf4.zip
vacuum: reduce indentation in add_record_to_delete_tree()
This simplyfies the logical structure a bit by using early return. (This used to be ctdb commit 4d32908fdcec120426536a761e1d0be60f076198)
-rw-r--r--ctdb/server/ctdb_vacuum.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/ctdb/server/ctdb_vacuum.c b/ctdb/server/ctdb_vacuum.c
index b83b9404a7..9a4e7ee4cf 100644
--- a/ctdb/server/ctdb_vacuum.c
+++ b/ctdb/server/ctdb_vacuum.c
@@ -98,35 +98,35 @@ static int add_record_to_delete_tree(struct vacuum_data *vdata, TDB_DATA key,
struct ctdb_context *ctdb = vdata->ctdb;
struct ctdb_db_context *ctdb_db = vdata->ctdb_db;
uint32_t hash;
+ struct delete_record_data *dd;
hash = ctdb_hash(&key);
if (trbt_lookup32(vdata->delete_tree, hash)) {
DEBUG(DEBUG_DEBUG, (__location__ " Hash collission when vacuuming, skipping this record.\n"));
- } else {
- struct delete_record_data *dd;
+ return 0;
+ }
- /* store key and header indexed by the key hash */
- dd = talloc_zero(vdata->delete_tree, struct delete_record_data);
- if (dd == NULL) {
- DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
- return -1;
- }
- dd->ctdb = ctdb;
- dd->ctdb_db = ctdb_db;
- dd->key.dsize = key.dsize;
- dd->key.dptr = talloc_memdup(dd, key.dptr, key.dsize);
- if (dd->key.dptr == NULL) {
- DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
- return -1;
- }
+ /* store key and header indexed by the key hash */
+ dd = talloc_zero(vdata->delete_tree, struct delete_record_data);
+ if (dd == NULL) {
+ DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
+ return -1;
+ }
+ dd->ctdb = ctdb;
+ dd->ctdb_db = ctdb_db;
+ dd->key.dsize = key.dsize;
+ dd->key.dptr = talloc_memdup(dd, key.dptr, key.dsize);
+ if (dd->key.dptr == NULL) {
+ DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
+ return -1;
+ }
- dd->hdr = *hdr;
+ dd->hdr = *hdr;
- trbt_insert32(vdata->delete_tree, hash, dd);
+ trbt_insert32(vdata->delete_tree, hash, dd);
- vdata->delete_count++;
- }
+ vdata->delete_count++;
return 0;
}