diff --git a/src/runtime/c/Makefile.am b/src/runtime/c/Makefile.am index c4eea5698..bc5ad0327 100644 --- a/src/runtime/c/Makefile.am +++ b/src/runtime/c/Makefile.am @@ -20,7 +20,6 @@ guinclude_HEADERS = \ gu/fun.h \ gu/hash.h \ gu/in.h \ - gu/intern.h \ gu/list.h \ gu/log.h \ gu/map.h \ @@ -59,7 +58,6 @@ libgu_la_SOURCES = \ gu/fun.c \ gu/hash.c \ gu/in.c \ - gu/intern.c \ gu/list.c \ gu/log.c \ gu/map.c \ diff --git a/src/runtime/c/gu/intern.c b/src/runtime/c/gu/intern.c deleted file mode 100644 index 35eaa1c5f..000000000 --- a/src/runtime/c/gu/intern.c +++ /dev/null @@ -1,59 +0,0 @@ -#include "intern.h" - -struct GuIntern { - GuPool* str_pool; - GuMap* map; -}; - -GuIntern* -gu_new_intern(GuPool* str_pool, GuPool* pool) -{ - GuIntern* intern = gu_new(GuIntern, pool); - intern->str_pool = str_pool; - intern->map = gu_new_set(const char*, gu_str_hasher, pool); - return intern; -} - -const char* -gu_intern_str(GuIntern* intern, const char* cstr) -{ - const char* const* strp = gu_map_find_key(intern->map, &cstr); - if (strp) { - return *strp; - } - const char* str = gu_strdup(cstr, intern->str_pool); - gu_map_insert(intern->map, &str); - return str; -} - - - - -struct GuSymTable { - GuPool* sym_pool; - GuMap* map; -}; - -GuSymTable* -gu_new_symtable(GuPool* sym_pool, GuPool* pool) -{ - GuSymTable* tab = gu_new(GuSymTable, pool); - tab->sym_pool = sym_pool; - tab->map = gu_new_set(GuSymbol, gu_string_hasher, pool); - return tab; -} - -GuSymbol -gu_symtable_intern(GuSymTable* tab, GuString string) -{ - if (gu_string_is_stable(string)) { - return string; - } - const GuSymbol* symp = gu_map_find_key(tab->map, &string); - if (symp) { - return *symp; - } - GuSymbol sym = gu_string_copy(string, tab->sym_pool); - gu_map_insert(tab->map, &sym); - return sym; -} diff --git a/src/runtime/c/gu/intern.h b/src/runtime/c/gu/intern.h deleted file mode 100644 index bf9e9b321..000000000 --- a/src/runtime/c/gu/intern.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef GU_INTERN_H_ -#define GU_INTERN_H_ - -#include -#include -#include - -typedef struct GuIntern GuIntern; - -GuIntern* gu_new_intern(GuPool* str_pool, GuPool* pool); -const char* gu_intern_str(GuIntern* intern, const char* cstr); - - -typedef struct GuSymTable GuSymTable; - -typedef GuString GuSymbol; - -GuSymTable* -gu_new_symtable(GuPool* sym_pool, GuPool* pool); - -GuSymbol -gu_symtable_intern(GuSymTable* symtab, GuString string); - -#endif /* GU_INTERN_H_ */ diff --git a/src/runtime/c/pgf/expr.c b/src/runtime/c/pgf/expr.c index b195eeea5..4b2644931 100644 --- a/src/runtime/c/pgf/expr.c +++ b/src/runtime/c/pgf/expr.c @@ -1,5 +1,4 @@ #include "pgf.h" -#include #include #include #include diff --git a/src/runtime/c/pgf/reader.c b/src/runtime/c/pgf/reader.c index 890749b5b..bf7207874 100644 --- a/src/runtime/c/pgf/reader.c +++ b/src/runtime/c/pgf/reader.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -28,7 +27,6 @@ struct PgfReader { GuExn* err; GuPool* opool; GuPool* tmp_pool; - GuSymTable* symtab; #ifndef ANDROID PgfJitState* jit_state; #endif @@ -108,11 +106,9 @@ pgf_read_cid(PgfReader* rdr) GuUCS ucs = gu_in_u8(rdr->in, rdr->err); gu_out_utf8(ucs, out, rdr->err); } - GuString str = gu_string_buf_freeze(sbuf, tmp_pool); - - GuSymbol sym = gu_symtable_intern(rdr->symtab, str); + GuString str = gu_string_buf_freeze(sbuf, rdr->opool); gu_pool_free(tmp_pool); - return sym; + return str; } static GuString @@ -128,11 +124,10 @@ pgf_read_string(PgfReader* rdr) GuUCS ucs = gu_in_utf8(rdr->in, rdr->err); gu_out_utf8(ucs, out, rdr->err); } - GuString str = gu_string_buf_freeze(sbuf, tmp_pool); - GuSymbol sym = gu_symtable_intern(rdr->symtab, str); + GuString str = gu_string_buf_freeze(sbuf, rdr->opool); gu_pool_free(tmp_pool); - return sym; + return str; } static void @@ -1215,7 +1210,6 @@ pgf_new_reader(GuIn* in, GuPool* opool, GuPool* tmp_pool, GuExn* err) PgfReader* rdr = gu_new(PgfReader, tmp_pool); rdr->opool = opool; rdr->tmp_pool = tmp_pool; - rdr->symtab = gu_new_symtable(opool, tmp_pool); rdr->err = err; rdr->in = in; #ifndef ANDROID diff --git a/src/ui/android/jni/Android.mk b/src/ui/android/jni/Android.mk index febd57a65..0cfe7937b 100644 --- a/src/ui/android/jni/Android.mk +++ b/src/ui/android/jni/Android.mk @@ -5,7 +5,7 @@ include $(CLEAR_VARS) jni_c_files := jpgf.c pgf_c_files := data.c expr.c graphviz.c lexer.c linearizer.c literals.c parser.c parseval.c pgf.c printer.c reader.c reasoner.c gu_c_files := assert.c choice.c exn.c fun.c in.c list.c map.c out.c str.c type.c utf8.c \ -bits.c defs.c enum.c file.c hash.c intern.c log.c mem.c prime.c seq.c string.c ucs.c variant.c +bits.c defs.c enum.c file.c hash.c log.c mem.c prime.c seq.c string.c ucs.c variant.c LOCAL_MODULE := jpgf LOCAL_SRC_FILES := $(addprefix ../../../runtime/java/, $(jni_c_files)) \