summaryrefslogtreecommitdiff
path: root/ext/gdbm
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/gdbm
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/gdbm')
-rw-r--r--ext/gdbm/gdbm.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/ext/gdbm/gdbm.c b/ext/gdbm/gdbm.c
index 2aa9010..85e2b33 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;
}