From a7842b6451cdb20c9a5aeebf81387e538aa0facf Mon Sep 17 00:00:00 2001 From: Yukihiro Matz Matsumoto Date: Tue, 26 Mar 2013 16:42:17 +0900 Subject: zero length array is GCC extension --- src/state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/state.c') diff --git a/src/state.c b/src/state.c index 7b5bd1002..92cce33a1 100644 --- a/src/state.c +++ b/src/state.c @@ -45,7 +45,7 @@ allocf(mrb_state *mrb, void *p, size_t size, void *ud) struct alloca_header { struct alloca_header *next; - char buf[0]; + char buf[1]; }; void* @@ -53,7 +53,7 @@ mrb_alloca(mrb_state *mrb, size_t size) { struct alloca_header *p; - p = (struct alloca_header*) mrb_malloc(mrb, sizeof(struct alloca_header)+size); + p = (struct alloca_header*) mrb_malloc(mrb, sizeof(struct alloca_header)+size-1); if (p == NULL) return NULL; p->next = mrb->mems; mrb->mems = p; -- cgit v1.2.3