diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-02-06 23:35:26 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-02-12 17:30:34 +0900 |
| commit | 37bc343e0ad6b837de672c8c0cf6bf00876f746b (patch) | |
| tree | ce675d6f6f0c120586a6c082e877424946e07e1f /src | |
| parent | 06ba5905f019ca1a8d8e498fe6dce7a94702c9ad (diff) | |
| download | mruby-37bc343e0ad6b837de672c8c0cf6bf00876f746b.tar.gz mruby-37bc343e0ad6b837de672c8c0cf6bf00876f746b.zip | |
Disable `Symbol.all_symbols`.
Diffstat (limited to 'src')
| -rw-r--r-- | src/symbol.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/symbol.c b/src/symbol.c index ab7504772..9cc566245 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -28,6 +28,7 @@ sym_validate_len(mrb_state *mrb, size_t len) } } +#ifndef MRB_ENABLE_ALL_SYMBOLS static char pack_table[] = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; static mrb_sym @@ -100,6 +101,7 @@ sym_inline_unpack(mrb_sym sym, char *buf) buf[i] = '\0'; return buf; } +#endif uint8_t symhash(const char *key, size_t len) @@ -123,9 +125,11 @@ find_symbol(mrb_state *mrb, const char *name, uint16_t len, uint8_t hash) mrb_sym i; symbol_name *sname; +#ifndef MRB_ENABLE_ALL_SYMBOLS /* inline symbol */ i = sym_inline_pack(name, len); if (i > 0) return i; +#endif i = mrb->symhash[hash]; if (i == 0) return 0; @@ -247,11 +251,13 @@ mrb_check_intern_str(mrb_state *mrb, mrb_value str) MRB_API const char* mrb_sym2name_len(mrb_state *mrb, mrb_sym sym, mrb_int *lenp) { +#ifndef MRB_ENABLE_ALL_SYMBOLS if (sym & 1) { /* inline packed symbol */ sym_inline_unpack(sym, mrb->symbuf); if (lenp) *lenp = strlen(mrb->symbuf); return mrb->symbuf; } +#endif sym >>= 1; if (sym == 0 || mrb->symidx < sym) { |
