diff options
author | Volker Lendecke <vl@samba.org> | 2013-02-19 12:23:36 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2013-02-19 17:30:13 +0100 |
commit | a7fdd4f7c2e64eedf12cb46c3435edbec772a4ab (patch) | |
tree | 45cf0e9498d70627d9c5315d9f552f1e3e21ffc9 /lib/tdb/common | |
parent | fcb345f5d6be9659a0f8a5afe62a937010a33d5c (diff) | |
download | samba-a7fdd4f7c2e64eedf12cb46c3435edbec772a4ab.tar.gz samba-a7fdd4f7c2e64eedf12cb46c3435edbec772a4ab.tar.bz2 samba-a7fdd4f7c2e64eedf12cb46c3435edbec772a4ab.zip |
tdb: Slightly simplify transaction_write
realloc(NULL, ...) is equivalent to malloc. We are already using this
realloc property for tdb->lockrecs. It should not make any difference
in speed, it just makes for a little simpler code.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Feb 19 17:30:13 CET 2013 on sn-devel-104
Diffstat (limited to 'lib/tdb/common')
-rw-r--r-- | lib/tdb/common/transaction.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/tdb/common/transaction.c b/lib/tdb/common/transaction.c index 42289fd0f6..a2498ec82d 100644 --- a/lib/tdb/common/transaction.c +++ b/lib/tdb/common/transaction.c @@ -249,14 +249,8 @@ static int transaction_write(struct tdb_context *tdb, tdb_off_t off, if (tdb->transaction->num_blocks <= blk) { uint8_t **new_blocks; /* expand the blocks array */ - if (tdb->transaction->blocks == NULL) { - new_blocks = (uint8_t **)malloc( - (blk+1)*sizeof(uint8_t *)); - } else { - new_blocks = (uint8_t **)realloc( - tdb->transaction->blocks, - (blk+1)*sizeof(uint8_t *)); - } + new_blocks = (uint8_t **)realloc(tdb->transaction->blocks, + (blk+1)*sizeof(uint8_t *)); if (new_blocks == NULL) { tdb->ecode = TDB_ERR_OOM; goto fail; |