diff options
author | rhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-22 07:18:55 +0000 |
---|---|---|
committer | rhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-22 07:18:55 +0000 |
commit | dd53157c9e1b352de0e7f41a863aeaf6ba298724 (patch) | |
tree | ec130d9d4e701446a7e66577723b1f32c8746be6 /ext/gdbm | |
parent | de7a010a502517d7a38d702646f2101e48a50129 (diff) | |
download | ruby-dd53157c9e1b352de0e7f41a863aeaf6ba298724.tar.gz |
gdbm, dbm, sdbm: remove unnecessary conditions
The dfree and dsize callback functions are never called with NULL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/gdbm')
-rw-r--r-- | ext/gdbm/gdbm.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/ext/gdbm/gdbm.c b/ext/gdbm/gdbm.c index 2aa9010c57..85e2b33f31 100644 --- a/ext/gdbm/gdbm.c +++ b/ext/gdbm/gdbm.c @@ -114,21 +114,18 @@ static void free_dbm(void *ptr) { struct dbmdata *dbmp = ptr; - if (dbmp) { - if (dbmp->di_dbm) gdbm_close(dbmp->di_dbm); - xfree(dbmp); - } + if (dbmp->di_dbm) + gdbm_close(dbmp->di_dbm); + xfree(dbmp); } static size_t memsize_dbm(const void *ptr) { - size_t size = 0; const struct dbmdata *dbmp = ptr; - if (dbmp) { - size += sizeof(*dbmp); - if (dbmp->di_dbm) size += DBM_SIZEOF_DBM; - } + size_t size = sizeof(*dbmp); + if (dbmp->di_dbm) + size += DBM_SIZEOF_DBM; return size; } |