From f263494e15a15fcc0e52165ea533695f434e6c8e Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 20 Feb 2022 15:25:43 -0800 Subject: [PATCH] cdt: [nfc] remove unnecessary casts of the return value of 'memoryf' --- lib/cdt/dthash.c | 5 ++--- lib/cdt/dtlist.c | 3 +-- lib/cdt/dtopen.c | 2 +- lib/cdt/dttree.c | 3 +-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/cdt/dthash.c b/lib/cdt/dthash.c index c9ec82819..a36b73014 100644 --- a/lib/cdt/dthash.c +++ b/lib/cdt/dthash.c @@ -47,7 +47,7 @@ static void dthtab(Dt_t* dt) /* allocate new table */ olds = dt->data->ntab == 0 ? NULL : dt->data->htab; - if(!(s = (Dtlink_t**)(*dt->memoryf)(dt,olds,n*sizeof(Dtlink_t*),dt->disc)) ) + if(!(s = (*dt->memoryf)(dt, olds, n * sizeof(Dtlink_t*), dt->disc)) ) return; olds = s + dt->data->ntab; dt->data->htab = s; @@ -210,8 +210,7 @@ static void* dthash(Dt_t* dt, void* obj, int type) if(lk >= 0) r = _DTLNK(obj,lk); else - { r = (Dtlink_t*)(*dt->memoryf) - (dt,NULL,sizeof(Dthold_t),disc); + { r = (*dt->memoryf)(dt, NULL, sizeof(Dthold_t), disc); if(r) ((Dthold_t*)r)->obj = obj; else diff --git a/lib/cdt/dtlist.c b/lib/cdt/dtlist.c index 6ec8d526f..7476b7020 100644 --- a/lib/cdt/dtlist.c +++ b/lib/cdt/dtlist.c @@ -56,8 +56,7 @@ static void* dtlist(Dt_t* dt, void* obj, int type) if(lk >= 0) r = _DTLNK(obj,lk); else - { r = (Dtlink_t*)(*dt->memoryf) - (dt,NULL,sizeof(Dthold_t),disc); + { r = (*dt->memoryf)(dt, NULL, sizeof(Dthold_t), disc); if(r) ((Dthold_t*)r)->obj = obj; else diff --git a/lib/cdt/dtopen.c b/lib/cdt/dtopen.c index ebe56a369..b5cc90ed4 100644 --- a/lib/cdt/dtopen.c +++ b/lib/cdt/dtopen.c @@ -58,7 +58,7 @@ Dt_t* dtopen(Dtdisc_t* disc, Dtmethod_t* meth) } /* allocate sharable data */ - if(!(data = (Dtdata_t*)(dt->memoryf)(dt,NULL,sizeof(Dtdata_t),disc)) ) + if(!(data = (dt->memoryf)(dt, NULL, sizeof(Dtdata_t), disc)) ) { err_open: free(dt); return NULL; diff --git a/lib/cdt/dttree.c b/lib/cdt/dttree.c index 77afd74fb..9b7f8656b 100644 --- a/lib/cdt/dttree.c +++ b/lib/cdt/dttree.c @@ -317,8 +317,7 @@ static void* dttree(Dt_t* dt, void* obj, int type) { if(lk >= 0) root = _DTLNK(obj,lk); else - { root = (Dtlink_t*)(*dt->memoryf) - (dt,NULL,sizeof(Dthold_t),disc); + { root = (*dt->memoryf)(dt, NULL, sizeof(Dthold_t), disc); if(root) ((Dthold_t*)root)->obj = obj; else if(disc->makef && disc->freef && -- 2.40.0