From e1ceef73192f0300ff9b10ba9a16475fbebeaa5f Mon Sep 17 00:00:00 2001 From: kartofen Date: Fri, 30 Aug 2024 17:01:28 +0300 Subject: proper repl, stylistic changes, removed trailing whitespace --- src/env.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/env.c') diff --git a/src/env.c b/src/env.c index a530a36..10aa651 100644 --- a/src/env.c +++ b/src/env.c @@ -8,7 +8,7 @@ #define ENV_TABLE_CAP (1 << 8) static unsigned long str_hash(char *str) -{ +{ unsigned long hash = 5381; int c; @@ -38,20 +38,20 @@ env_t env_create(env_t parent, env_destroy_func destroy_func) env->destroy_func = destroy_func; env->parent = parent; env->refs = 1; - + ERR_Z(env->table = hashtable_create(ENV_TABLE_CAP, hash, equal), env_destroy(env)); - + return env; } void env_destroy(env_t env) { if(!env) return; - + env->refs--; env_destroy(env->parent); - + if(env->refs > 0) return; hashtable_for_each_item(env->table, item, i) { @@ -65,7 +65,7 @@ void env_destroy(env_t env) env_t env_copy(env_t env) { if(env == ENV_EMPTY) return ENV_EMPTY; - + env->refs++; env_copy(env->parent); -- cgit v1.2.3