8000 py: Use <alloca.h> for alloca() · micropython/micropython@98e2ee0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 98e2ee0

Browse files
committed
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.
1 parent 8f472ad commit 98e2ee0

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

py/builtinimport.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
#include <stdint.h>
2-
#include <stdlib.h>
32
#include <stdio.h>
43
#include <string.h>
54
#include <assert.h>
6-
#ifdef __MINGW32__
7-
// For alloca()
8-
#include <malloc.h>
9-
#endif
5+
#include <alloca.h>
106

117
#include "mpconfig.h"
128
#include "nlr.h"

py/objfun.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
#include <stdbool.h>
2-
#include <stdlib.h>
32
#include <string.h>
43
#include <assert.h>
5-
#ifdef __MINGW32__
6-
// For alloca()
7-
#include <malloc.h>
8-
#endif
4+
#include <alloca.h>
95

106
#include "mpconfig.h"
117
#include "nlr.h"

windows/alloca.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include <malloc.h>

0 commit comments

Comments
 (0)
0