Commit 7ba30960 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #982 from monaka/pr-make-MRB_STR_BUF_MIN_SIZE-configurable

Rename STR_BUF_MIN_SIZE to MRB_STR_BUF_MIN_SIZE. Make it configurable.
parents 2134d6b4 e2d31ba3
...@@ -46,6 +46,10 @@ ...@@ -46,6 +46,10 @@
/* page size of memory pool */ /* page size of memory pool */
//#define POOL_PAGE_SIZE 16000 //#define POOL_PAGE_SIZE 16000
/* initial minimum size for string buffer */
//#define MRB_STR_BUF_MIN_SIZE 128
/* -DDISABLE_XXXX to drop following features */ /* -DDISABLE_XXXX to drop following features */
//#define DISABLE_STDIO /* use of stdio */ //#define DISABLE_STDIO /* use of stdio */
......
...@@ -13,8 +13,6 @@ extern "C" { ...@@ -13,8 +13,6 @@ extern "C" {
#define IS_EVSTR(p,e) ((p) < (e) && (*(p) == '$' || *(p) == '@' || *(p) == '{')) #define IS_EVSTR(p,e) ((p) < (e) && (*(p) == '$' || *(p) == '@' || *(p) == '{'))
#define STR_BUF_MIN_SIZE 128
extern const char mrb_digitmap[]; extern const char mrb_digitmap[];
typedef struct mrb_shared_string { typedef struct mrb_shared_string {
......
...@@ -158,6 +158,10 @@ mrb_str_new_empty(mrb_state *mrb, mrb_value str) ...@@ -158,6 +158,10 @@ mrb_str_new_empty(mrb_state *mrb, mrb_value str)
return mrb_obj_value(s); return mrb_obj_value(s);
} }
#ifndef MRB_STR_BUF_MIN_SIZE
# define MRB_STR_BUF_MIN_SIZE 128
#endif
mrb_value mrb_value
mrb_str_buf_new(mrb_state *mrb, int capa) mrb_str_buf_new(mrb_state *mrb, int capa)
{ {
...@@ -165,8 +169,8 @@ mrb_str_buf_new(mrb_state *mrb, int capa) ...@@ -165,8 +169,8 @@ mrb_str_buf_new(mrb_state *mrb, int capa)
s = mrb_obj_alloc_string(mrb); s = mrb_obj_alloc_string(mrb);
if (capa < STR_BUF_MIN_SIZE) { if (capa < MRB_STR_BUF_MIN_SIZE) {
capa = STR_BUF_MIN_SIZE; capa = MRB_STR_BUF_MIN_SIZE;
} }
s->len = 0; s->len = 0;
s->aux.capa = capa; s->aux.capa = capa;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment