]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tdb: Slightly simplify transaction_write
authorVolker Lendecke <vl@samba.org>
Tue, 19 Feb 2013 11:23:36 +0000 (12:23 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 19 Feb 2013 16:30:13 +0000 (17:30 +0100)
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

lib/tdb/common/transaction.c

index 42289fd0f6c38be2efbe6bc4b12337a5b5635c60..a2498ec82dbd7ab60d13d453cbf1157ea15ac97c 100644 (file)
@@ -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;