mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
zero length array is GCC extension
This commit is contained in:
+2
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user