mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
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 <obnox@samba.org>
This commit is contained in:
parent
24c36e7484
commit
b206b52748
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user