tisp

tiny lisp
git clone git://edryd.org/tisp
Log | Files | Refs | LICENSE

commit 2e4800a32eca935b04d10aa4a4d4165f6352fb96
parent 70ae628f495a1b219a3444d3cc1e60373bbe3cc1
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Thu, 23 Aug 2018 22:57:21 -0700

Us malloc when calloc is not necessary

Diffstat:
tisp.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tisp.c b/tisp.c @@ -604,23 +604,23 @@ prim_load(Env env, Val args) env->libh = erealloc(env->libh, (env->libhc+1)*sizeof(void*)); - lib = ecalloc(strlen(v->v.s)+10, sizeof(char)); + lib = emalloc((strlen(v->v.s)+10) * sizeof(char)); strcat(lib, "libtib"); strcat(lib, v->v.s); strcat(lib, ".so"); if (!(env->libh[env->libhc] = dlopen(lib, RTLD_LAZY))) warnf("load: could not load [%s]: %s", v->v.s, dlerror()); dlerror(); - efree(lib); + free(lib); - func = ecalloc(strlen(v->v.s)+9, sizeof(char)); + func = emalloc((strlen(v->v.s)+9) * sizeof(char)); strcat(func, "tib_env_"); strcat(func, v->v.s); tibenv = dlsym(env->libh[env->libhc], func); if (dlerror()) warnf("load: could not run [%s]: %s", v->v.s, dlerror()); (*tibenv)(env); - efree(func); + free(func); env->libhc++; return NULL;