diff options
author | delphij <delphij@FreeBSD.org> | 2009-03-05 00:57:01 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2009-03-05 00:57:01 +0000 |
commit | 02654885c3218680f7784a94dec913420f7a033e (patch) | |
tree | dca880f0029284c8bf3480757527c76481cbab7e /lib/libc/db/recno/rec_utils.c | |
parent | 1b605ed6f8f06715dccab8708ba5d26251cde30a (diff) | |
download | FreeBSD-src-02654885c3218680f7784a94dec913420f7a033e.zip FreeBSD-src-02654885c3218680f7784a94dec913420f7a033e.tar.gz |
Our realloc(3) and reallocf(3) can handle NULL, which turns it into a
malloc(3) call, so don't test if a pointer is NULL.
Obtained from: OpenBSD (in spirit)
Diffstat (limited to 'lib/libc/db/recno/rec_utils.c')
-rw-r--r-- | lib/libc/db/recno/rec_utils.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/libc/db/recno/rec_utils.c b/lib/libc/db/recno/rec_utils.c index 0294d95..39285a5 100644 --- a/lib/libc/db/recno/rec_utils.c +++ b/lib/libc/db/recno/rec_utils.c @@ -67,9 +67,7 @@ __rec_ret(BTREE *t, EPG *e, recno_t nrec, DBT *key, DBT *data) /* We have to copy the key, it's not on the page. */ if (sizeof(recno_t) > t->bt_rkey.size) { - p = (void *)(t->bt_rkey.data == NULL ? - malloc(sizeof(recno_t)) : - realloc(t->bt_rkey.data, sizeof(recno_t))); + p = realloc(t->bt_rkey.data, sizeof(recno_t)); if (p == NULL) return (RET_ERROR); t->bt_rkey.data = p; @@ -97,9 +95,7 @@ dataonly: } else if (F_ISSET(t, B_DB_LOCK)) { /* Use +1 in case the first record retrieved is 0 length. */ if (rl->dsize + 1 > t->bt_rdata.size) { - p = (void *)(t->bt_rdata.data == NULL ? - malloc(rl->dsize + 1) : - realloc(t->bt_rdata.data, rl->dsize + 1)); + p = realloc(t->bt_rdata.data, rl->dsize + 1); if (p == NULL) return (RET_ERROR); t->bt_rdata.data = p; |