summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-12-16 10:43:06 +0100
committerMichael Adam <obnox@samba.org>2011-12-23 17:39:06 +0100
commitc9b53967832bbfa3a9675c20f3f1132e869814bb (patch)
tree1b2c5ba56b57875cd1b128b50bf8a63e1410d275
parent491c63c2a833e795c77d233ebdf3b348697e2bfc (diff)
downloadsamba-c9b53967832bbfa3a9675c20f3f1132e869814bb.tar.gz
samba-c9b53967832bbfa3a9675c20f3f1132e869814bb.tar.xz
samba-c9b53967832bbfa3a9675c20f3f1132e869814bb.zip
vacuum: introduce a helper variable in add_record_to_vacuum_fetch_list() to reduce verbosity
(This used to be ctdb commit 48fe56ea27e3649ae7a67257fdce54f973e7c3c5)
-rw-r--r--ctdb/server/ctdb_vacuum.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/ctdb/server/ctdb_vacuum.c b/ctdb/server/ctdb_vacuum.c
index 6e090ff246..586c2e54cd 100644
--- a/ctdb/server/ctdb_vacuum.c
+++ b/ctdb/server/ctdb_vacuum.c
@@ -173,27 +173,30 @@ static int add_record_to_vacuum_fetch_list(struct vacuum_data *vdata,
struct ctdb_rec_data *rec;
uint32_t lmaster;
size_t old_size;
+ struct ctdb_marshall_buffer *vfl;
lmaster = ctdb_lmaster(ctdb, &key);
- rec = ctdb_marshall_record(vdata->list[lmaster], ctdb->pnn, key, NULL, tdb_null);
+ vfl = vdata->list[lmaster];
+
+ rec = ctdb_marshall_record(vfl, ctdb->pnn, key, NULL, tdb_null);
if (rec == NULL) {
DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
vdata->traverse_error = true;
return -1;
}
- old_size = talloc_get_size(vdata->list[lmaster]);
- vdata->list[lmaster] = talloc_realloc_size(NULL, vdata->list[lmaster],
- old_size + rec->length);
- if (vdata->list[lmaster] == NULL) {
+ old_size = talloc_get_size(vfl);
+ vfl = talloc_realloc_size(NULL, vfl, old_size + rec->length);
+ if (vfl == NULL) {
DEBUG(DEBUG_ERR,(__location__ " Failed to expand\n"));
vdata->traverse_error = true;
return -1;
}
+ vdata->vacuum_fetch_list[lmaster] = vfl;
- vdata->list[lmaster]->count++;
- memcpy(old_size+(uint8_t *)vdata->list[lmaster], rec, rec->length);
+ vfl->count++;
+ memcpy(old_size+(uint8_t *)vfl, rec, rec->length);
talloc_free(rec);
vdata->total++;