summaryrefslogtreecommitdiffhomepage
path: root/src/state.c
diff options
context:
space:
mode:
authorMasaki Muranaka <[email protected]>2013-02-25 13:57:33 +0900
committerMasaki Muranaka <[email protected]>2013-02-25 13:59:20 +0900
commit6dda588503cb617536db8f4e871cad2b9292173f (patch)
tree485bf73d553cb727a144f602b111964bb1276657 /src/state.c
parent8a9026426e3355d8f0080df506855832b528c6a3 (diff)
downloadmruby-6dda588503cb617536db8f4e871cad2b9292173f.tar.gz
mruby-6dda588503cb617536db8f4e871cad2b9292173f.zip
Use MRB_IREP_ARRAY_INIT_SIZE macro. It should be configurable since it is possible to reduce RAM size.
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/state.c b/src/state.c
index 53773ac89..19b0b660f 100644
--- a/src/state.c
+++ b/src/state.c
@@ -110,6 +110,10 @@ mrb_close(mrb_state *mrb)
mrb_free(mrb, mrb);
}
+#ifndef MRB_IREP_ARRAY_INIT_SIZE
+# define MRB_IREP_ARRAY_INIT_SIZE (256u)
+#endif
+
mrb_irep*
mrb_add_irep(mrb_state *mrb)
{
@@ -117,7 +121,7 @@ mrb_add_irep(mrb_state *mrb)
mrb_irep *irep;
if (!mrb->irep) {
- int max = 256;
+ size_t max = MRB_IREP_ARRAY_INIT_SIZE;
if (mrb->irep_len > max) max = mrb->irep_len+1;
mrb->irep = (mrb_irep **)mrb_calloc(mrb, max, sizeof(mrb_irep*));