From b206b5274878bbf47cd19db0fccc025a1ac16784 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 7 Nov 2012 16:25:31 +0100 Subject: [PATCH] s3: Remove header==NULL code from db_ctdb_marshall_record The only call chain (via db_ctdb_marshall_add) has header != NULL Reviewed-by: Michael Adam --- source3/lib/dbwrap/dbwrap_ctdb.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c index e4c87ead4f5..5be4bf7c6aa 100644 --- a/source3/lib/dbwrap/dbwrap_ctdb.c +++ b/source3/lib/dbwrap/dbwrap_ctdb.c @@ -177,9 +177,6 @@ static NTSTATUS db_ctdb_ltdb_store(struct db_ctdb_ctx *db, /* form a ctdb_rec_data record from a key/data pair - - note that header may be NULL. If not NULL then it is included in the data portion - of the record */ static struct ctdb_rec_data *db_ctdb_marshall_record(TALLOC_CTX *mem_ctx, uint32_t reqid, TDB_DATA key, @@ -190,7 +187,7 @@ static struct ctdb_rec_data *db_ctdb_marshall_record(TALLOC_CTX *mem_ctx, uint32 struct ctdb_rec_data *d; length = offsetof(struct ctdb_rec_data, data) + key.dsize + - data.dsize + (header?sizeof(*header):0); + data.dsize + sizeof(*header); d = (struct ctdb_rec_data *)talloc_size(mem_ctx, length); if (d == NULL) { return NULL; @@ -199,14 +196,10 @@ static struct ctdb_rec_data *db_ctdb_marshall_record(TALLOC_CTX *mem_ctx, uint32 d->reqid = reqid; d->keylen = key.dsize; memcpy(&d->data[0], key.dptr, key.dsize); - if (header) { - d->datalen = data.dsize + sizeof(*header); - memcpy(&d->data[key.dsize], header, sizeof(*header)); - memcpy(&d->data[key.dsize+sizeof(*header)], data.dptr, data.dsize); - } else { - d->datalen = data.dsize; - memcpy(&d->data[key.dsize], data.dptr, data.dsize); - } + + d->datalen = data.dsize + sizeof(*header); + memcpy(&d->data[key.dsize], header, sizeof(*header)); + memcpy(&d->data[key.dsize+sizeof(*header)], data.dptr, data.dsize); return d; } -- 2.11.4.GIT