diff options
author | kartofen <mladenovnasko0@gmail.com> | 2024-11-03 17:35:51 +0200 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2024-11-03 17:35:51 +0200 |
commit | 0dd38d08551ac2fcff53eb604f6363f37b25aef9 (patch) | |
tree | b9c29e5c0a3467cc6fbec72fb292e5414a8c7f4b /src/env.h | |
parent | 7edffea39a3d666098ebeca27ea398769e8b981b (diff) |
env is just linked list now, uses much less memory
Diffstat (limited to 'src/env.h')
-rw-r--r-- | src/env.h | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -1,22 +1,26 @@ #ifndef ENV_H #define ENV_H +#include "list.h" + // #include "value.h" typedef struct value * _value_t; typedef struct env * env_t; #define ENV_EMPTY NULL -typedef void (*env_destroy_func)(char *key, _value_t value); +enum env_kv_flag { + ENV_KV_FREE_KEY = 1, + ENV_KV_CIRCULAR_REF = 2 +}; -env_t env_create(env_t parent, env_destroy_func destroy_func); +env_t env_create(env_t parent); void env_destroy(env_t env); -int env_insert(env_t env, char *key, _value_t data, - char **prevkey, _value_t *prevdata); +int env_insert(env_t env, char *key, _value_t value, + _value_t *prevval, int flags); int env_query(env_t env, char *key, _value_t *data); env_t env_copy(env_t env); -env_t env_parent(env_t env); #endif |