diff options
author | Volker Lendecke <vl@samba.org> | 2011-12-09 16:39:09 +0100 |
---|---|---|
committer | Volker Lendecke <vlendec@samba.org> | 2011-12-13 17:27:26 +0100 |
commit | 3239c722aa528a4f00f3201425182f7f105dbfe2 (patch) | |
tree | f7d6ee1a1468cf711bb1cb0d762ab656e8215cd5 /source3/lib | |
parent | 3cf275cd754486e07a891fbcb0607afb171d5359 (diff) | |
download | samba-3239c722aa528a4f00f3201425182f7f105dbfe2.tar.gz samba-3239c722aa528a4f00f3201425182f7f105dbfe2.tar.xz samba-3239c722aa528a4f00f3201425182f7f105dbfe2.zip |
s3-dbwrap: Simplify db_tdb_fetchlock_parse a bit
Introduce a local variable for the result, replace "state->result" by "result"
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/dbwrap/dbwrap_tdb.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/source3/lib/dbwrap/dbwrap_tdb.c b/source3/lib/dbwrap/dbwrap_tdb.c index 6a4636a9871..fbb05cc2a83 100644 --- a/source3/lib/dbwrap/dbwrap_tdb.c +++ b/source3/lib/dbwrap/dbwrap_tdb.c @@ -73,28 +73,29 @@ static int db_tdb_fetchlock_parse(TDB_DATA key, TDB_DATA data, { struct tdb_fetch_locked_state *state = (struct tdb_fetch_locked_state *)private_data; + struct db_record *result; - state->result = (struct db_record *)talloc_size( + result = (struct db_record *)talloc_size( state->mem_ctx, sizeof(struct db_record) + key.dsize + data.dsize); - if (state->result == NULL) { + if (result == NULL) { return 0; } + state->result = result; - state->result->key.dsize = key.dsize; - state->result->key.dptr = ((uint8 *)state->result) - + sizeof(struct db_record); - memcpy(state->result->key.dptr, key.dptr, key.dsize); + result->key.dsize = key.dsize; + result->key.dptr = ((uint8 *)result) + sizeof(struct db_record); + memcpy(result->key.dptr, key.dptr, key.dsize); - state->result->value.dsize = data.dsize; + result->value.dsize = data.dsize; if (data.dsize > 0) { - state->result->value.dptr = state->result->key.dptr+key.dsize; - memcpy(state->result->value.dptr, data.dptr, data.dsize); + result->value.dptr = result->key.dptr+key.dsize; + memcpy(result->value.dptr, data.dptr, data.dsize); } else { - state->result->value.dptr = NULL; + result->value.dptr = NULL; } return 0; |