diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-07-30 10:42:11 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:38:25 -0500 |
commit | 5a5deade6e4634aad561139f39337c9a960c0b80 (patch) | |
tree | 9907286b6e90ac4dfbbdf1194c08c99cd07701e7 /source3/tdb/transaction.c | |
parent | 2c6030415e0b1f421ea6e85fe6ffe7389ee7a941 (diff) | |
download | samba-5a5deade6e4634aad561139f39337c9a960c0b80.tar.gz samba-5a5deade6e4634aad561139f39337c9a960c0b80.tar.bz2 samba-5a5deade6e4634aad561139f39337c9a960c0b80.zip |
r17315: Make talloc and tdb C++-warning-free. Would this also be interesting in talloc
and tdb "upstream"?
Volker
(This used to be commit 68c43191c8aa4faa9801e0ab084a216ceaf4379d)
Diffstat (limited to 'source3/tdb/transaction.c')
-rw-r--r-- | source3/tdb/transaction.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/source3/tdb/transaction.c b/source3/tdb/transaction.c index aa54c4ae3c..b71728db5c 100644 --- a/source3/tdb/transaction.c +++ b/source3/tdb/transaction.c @@ -258,7 +258,8 @@ static int transaction_write(struct tdb_context *tdb, tdb_off_t off, off > tdb->transaction->old_map_size)) { unsigned char *data = best_el->data; el = best_el; - el->data = realloc(el->data, el->length + len); + el->data = (unsigned char *)realloc(el->data, + el->length + len); if (el->data == NULL) { tdb->ecode = TDB_ERR_OOM; tdb->transaction->transaction_error = 1; @@ -275,7 +276,7 @@ static int transaction_write(struct tdb_context *tdb, tdb_off_t off, } /* add a new entry at the end of the list */ - el = malloc(sizeof(*el)); + el = (struct tdb_transaction_el *)malloc(sizeof(*el)); if (el == NULL) { tdb->ecode = TDB_ERR_OOM; tdb->transaction->transaction_error = 1; @@ -285,7 +286,7 @@ static int transaction_write(struct tdb_context *tdb, tdb_off_t off, el->prev = tdb->transaction->elements_last; el->offset = off; el->length = len; - el->data = malloc(len); + el->data = (unsigned char *)malloc(len); if (el->data == NULL) { free(el); tdb->ecode = TDB_ERR_OOM; @@ -411,7 +412,8 @@ int tdb_transaction_start(struct tdb_context *tdb) return -1; } - tdb->transaction = calloc(sizeof(struct tdb_transaction), 1); + tdb->transaction = (struct tdb_transaction *) + calloc(sizeof(struct tdb_transaction), 1); if (tdb->transaction == NULL) { tdb->ecode = TDB_ERR_OOM; return -1; @@ -437,7 +439,8 @@ int tdb_transaction_start(struct tdb_context *tdb) /* setup a copy of the hash table heads so the hash scan in traverse can be fast */ - tdb->transaction->hash_heads = calloc(tdb->header.hash_size+1, sizeof(tdb_off_t)); + tdb->transaction->hash_heads = (unsigned int *) + calloc(tdb->header.hash_size+1, sizeof(tdb_off_t)); if (tdb->transaction->hash_heads == NULL) { tdb->ecode = TDB_ERR_OOM; goto fail; @@ -678,7 +681,7 @@ static int transaction_setup_recovery(struct tdb_context *tdb, return -1; } - data = malloc(recovery_size + sizeof(*rec)); + data = (unsigned char *)malloc(recovery_size + sizeof(*rec)); if (data == NULL) { tdb->ecode = TDB_ERR_OOM; return -1; @@ -960,7 +963,7 @@ int tdb_transaction_recover(struct tdb_context *tdb) recovery_eof = rec.key_len; - data = malloc(rec.data_len); + data = (unsigned char *)malloc(rec.data_len); if (data == NULL) { TDB_LOG((tdb, 0, "tdb_transaction_recover: failed to allocate recovery data\n")); tdb->ecode = TDB_ERR_OOM; |