mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
de7a010a50
commit
dd53157c9e
3 changed files with 15 additions and 23 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,12 +99,10 @@ free_sdbm(void *ptr)
|
|||
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 += sizeof(DBM);
|
||||
}
|
||||
size_t size = sizeof(*dbmp);
|
||||
if (dbmp->di_dbm)
|
||||
size += sizeof(DBM);
|
||||
return size;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue