diff options
author | kartofen <mladenovnasko0@gmail.com> | 2024-08-30 17:01:28 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2024-08-30 17:01:28 +0300 |
commit | e1ceef73192f0300ff9b10ba9a16475fbebeaa5f (patch) | |
tree | 0cb2bc5336a522b965c1d171b433044591721e20 /src/env.c | |
parent | de3a062bfc206bf0373f96f4f6cc8c74ffcbab48 (diff) |
proper repl, stylistic changes, removed trailing whitespace
Diffstat (limited to 'src/env.c')
-rw-r--r-- | src/env.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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); |