From 9742689c407ecd4a9dce786898c4682701c113fa Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Thu, 27 Mar 2014 16:23:22 +0900 Subject: [PATCH] Revert "reserve the 0 symbol for system use" This reverts commit 816343bd31628180e5118ef8f093e61dc2f138b6. Conflicts: include/picrin/value.h src/state.c --- include/picrin/value.h | 3 --- src/state.c | 5 ----- 2 files changed, 8 deletions(-) diff --git a/include/picrin/value.h b/include/picrin/value.h index 88266491..8079dae9 100644 --- a/include/picrin/value.h +++ b/include/picrin/value.h @@ -11,9 +11,6 @@ extern "C" { /** * pic_sym is just an alias to unsigned int. - * the value 0 for pic_sym is guaranteed to resolve to no symbol. - * if you are defining a function that returns optional, - * the zero symbol would be useful for such situation. */ typedef unsigned pic_sym; diff --git a/src/state.c b/src/state.c index 5506670f..37fab568 100644 --- a/src/state.c +++ b/src/state.c @@ -75,9 +75,6 @@ pic_open(int argc, char *argv[], char **envp) /* native stack marker */ pic->native_stack_start = &t; - /* symbol 0 is reserved for system */ - xh_put(&pic->sym_names, pic->sym_cnt++, &""); - #define register_core_symbol(pic,slot,name) do { \ pic->slot = pic_intern_cstr(pic, name); \ } while (0) @@ -159,8 +156,6 @@ pic_close(pic_state *pic) /* free symbol names */ xh_begin(&it, &pic->sym_names); while (xh_next(&it)) { - if (xh_key(it.e, pic_sym) == 0) - continue; free(xh_val(it.e, char *)); } xh_destroy(&pic->sym_names);