From 98e2ee0ec184c4c41cd0b6a633fe75a1fe40f8d3 Mon Sep 17 00:00:00 2001
From: stijn <stinos@zoho.com>
Date: Sat, 3 May 2014 10:14:16 +0200
Subject: [PATCH] py: Use <alloca.h> for alloca()

alloca() is declared in alloca.h which als happens to be included by stdlib.h.
On mingw however it resides in malloc.h only.
So if we include alloca.h directly, and add an alloca.h for mingw in it's port
directory we can get rid of the mingw-specific define to include malloc.h
and the other ports are happy as well.
---
 py/builtinimport.c | 6 +-----
 py/objfun.c        | 6 +-----
 windows/alloca.h   | 1 +
 3 files changed, 3 insertions(+), 10 deletions(-)
 create mode 100644 windows/alloca.h

diff --git a/py/builtinimport.c b/py/builtinimport.c
index 323b63ef6..f4e089b5d 100644
--- a/py/builtinimport.c
+++ b/py/builtinimport.c
@@ -1,12 +1,8 @@
 #include <stdint.h>
-#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
-#ifdef __MINGW32__
-// For alloca()
-#include <malloc.h>
-#endif
+#include <alloca.h>
 
 #include "mpconfig.h"
 #include "nlr.h"
diff --git a/py/objfun.c b/py/objfun.c
index e0c25771e..2855c7452 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -1,11 +1,7 @@
 #include <stdbool.h>
-#include <stdlib.h>
 #include <string.h>
 #include <assert.h>
-#ifdef __MINGW32__
-// For alloca()
-#include <malloc.h>
-#endif
+#include <alloca.h>
 
 #include "mpconfig.h"
 #include "nlr.h"
diff --git a/windows/alloca.h b/windows/alloca.h
new file mode 100644
index 000000000..f8fa6f17a
--- /dev/null
+++ b/windows/alloca.h
@@ -0,0 +1 @@
+#include <malloc.h>
-- 
GitLab