diff options
| -rw-r--r-- | include/mrbconf.h | 4 | ||||
| -rw-r--r-- | include/mruby/string.h | 2 | ||||
| -rw-r--r-- | src/string.c | 8 |
3 files changed, 10 insertions, 4 deletions
diff --git a/include/mrbconf.h b/include/mrbconf.h index 52490ceba..cabc10b4f 100644 --- a/include/mrbconf.h +++ b/include/mrbconf.h @@ -46,6 +46,10 @@ /* page size of memory pool */ //#define POOL_PAGE_SIZE 16000 +/* initial minimum size for string buffer */ +//#define MRB_STR_BUF_MIN_SIZE 128 + + /* -DDISABLE_XXXX to drop following features */ //#define DISABLE_STDIO /* use of stdio */ diff --git a/include/mruby/string.h b/include/mruby/string.h index 4ba4ce544..bc79477b1 100644 --- a/include/mruby/string.h +++ b/include/mruby/string.h @@ -13,8 +13,6 @@ extern "C" { #define IS_EVSTR(p,e) ((p) < (e) && (*(p) == '$' || *(p) == '@' || *(p) == '{')) -#define STR_BUF_MIN_SIZE 128 - extern const char mrb_digitmap[]; typedef struct mrb_shared_string { diff --git a/src/string.c b/src/string.c index bcf229388..95279a734 100644 --- a/src/string.c +++ b/src/string.c @@ -156,6 +156,10 @@ mrb_str_new_empty(mrb_state *mrb, mrb_value str) return mrb_obj_value(s); } +#ifndef MRB_STR_BUF_MIN_SIZE +# define MRB_STR_BUF_MIN_SIZE 128 +#endif + mrb_value mrb_str_buf_new(mrb_state *mrb, int capa) { @@ -163,8 +167,8 @@ mrb_str_buf_new(mrb_state *mrb, int capa) s = mrb_obj_alloc_string(mrb); - if (capa < STR_BUF_MIN_SIZE) { - capa = STR_BUF_MIN_SIZE; + if (capa < MRB_STR_BUF_MIN_SIZE) { + capa = MRB_STR_BUF_MIN_SIZE; } s->len = 0; s->aux.capa = capa; |
