summaryrefslogtreecommitdiff
path: root/ext/dbm
diff options
context:
space:
mode:
authorrhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-22 07:18:55 (GMT)
committerrhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-22 07:18:55 (GMT)
commitdd53157c9e1b352de0e7f41a863aeaf6ba298724 (patch)
treeec130d9d4e701446a7e66577723b1f32c8746be6 /ext/dbm
parentde7a010a502517d7a38d702646f2101e48a50129 (diff)
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/dbm')
-rw-r--r--ext/dbm/dbm.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c
index 1f69f68..4ac6898 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -59,21 +59,18 @@ static void
free_dbm(void *ptr)
{
struct dbmdata *dbmp = ptr;
- if (dbmp) {
- if (dbmp->di_dbm) dbm_close(dbmp->di_dbm);
- xfree(dbmp);
- }
+ if (dbmp->di_dbm)
+ dbm_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;
}