1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-26 00:10:27 +00:00

Remove janet_symbol_from_string api function.

This commit is contained in:
Calvin Rose 2019-01-02 20:50:31 -05:00
parent a679f60e07
commit 5fff36d047
2 changed files with 2 additions and 13 deletions

View File

@ -190,17 +190,6 @@ const uint8_t *janet_csymbol(const char *cstr) {
return janet_symbol((const uint8_t *)cstr, len); return janet_symbol((const uint8_t *)cstr, len);
} }
/* Convert a string to a symbol */
const uint8_t *janet_symbol_from_string(const uint8_t *str) {
int success = 0;
const uint8_t **bucket = janet_symcache_find(str, &success);
if (success)
return *bucket;
janet_symcache_put((const uint8_t *)str, bucket);
janet_gc_settype(janet_string_raw(str), JANET_MEMORY_SYMBOL);
return str;
}
/* Store counter for genysm to avoid quadratic behavior */ /* Store counter for genysm to avoid quadratic behavior */
JANET_THREAD_LOCAL uint8_t gensym_counter[8] = {'_', '0', '0', '0', '0', '0', '0', 0}; JANET_THREAD_LOCAL uint8_t gensym_counter[8] = {'_', '0', '0', '0', '0', '0', '0', 0};

View File

@ -568,6 +568,8 @@ JANET_API int janet_checkint64(Janet x);
#define janet_unwrap_integer(x) ((int32_t) janet_unwrap_number(x)) #define janet_unwrap_integer(x) ((int32_t) janet_unwrap_number(x))
#define janet_wrap_integer(x) janet_wrap_number((int32_t)(x)) #define janet_wrap_integer(x) janet_wrap_number((int32_t)(x))
#define janet_checktypes(x, tps) ((janet_type(x) << 1) & (tps))
/* Hold components of arguments passed to JanetCFunction. */ /* Hold components of arguments passed to JanetCFunction. */
struct JanetArgs { struct JanetArgs {
Janet *v; Janet *v;
@ -987,7 +989,6 @@ JANET_API void janet_puts(const uint8_t *str);
/* Symbol functions */ /* Symbol functions */
JANET_API const uint8_t *janet_symbol(const uint8_t *str, int32_t len); JANET_API const uint8_t *janet_symbol(const uint8_t *str, int32_t len);
JANET_API const uint8_t *janet_symbol_from_string(const uint8_t *str);
JANET_API const uint8_t *janet_csymbol(const char *str); JANET_API const uint8_t *janet_csymbol(const char *str);
JANET_API const uint8_t *janet_symbol_gen(void); JANET_API const uint8_t *janet_symbol_gen(void);
#define janet_symbolv(str, len) janet_wrap_symbol(janet_symbol((str), (len))) #define janet_symbolv(str, len) janet_wrap_symbol(janet_symbol((str), (len)))
@ -995,7 +996,6 @@ JANET_API const uint8_t *janet_symbol_gen(void);
/* Keyword functions */ /* Keyword functions */
#define janet_keyword janet_symbol #define janet_keyword janet_symbol
#define janet_keyword_from_string janet_symbol_from_string
#define janet_ckeyword janet_csymbol #define janet_ckeyword janet_csymbol
#define janet_keywordv(str, len) janet_wrap_keyword(janet_keyword((str), (len))) #define janet_keywordv(str, len) janet_wrap_keyword(janet_keyword((str), (len)))
#define janet_ckeywordv(cstr) janet_wrap_keyword(janet_ckeyword(cstr)) #define janet_ckeywordv(cstr) janet_wrap_keyword(janet_ckeyword(cstr))