|
|
@@ -37,17 +37,18 @@
|
|
37
|
37
|
|
|
38
|
38
|
#include <sys/stat.h>
|
|
39
|
39
|
#include <errno.h>
|
|
|
40
|
+#include <stddef.h>
|
|
40
|
41
|
|
|
41
|
42
|
/* If CONFIG_HEAP_START (or CONFIG_HEAP_END) isn't defined, then
|
|
42
|
43
|
* assume _lm_heap_start (resp. _lm_heap_end) is appropriately set by
|
|
43
|
44
|
* the linker */
|
|
44
|
45
|
#ifndef CONFIG_HEAP_START
|
|
45
|
46
|
extern char _lm_heap_start;
|
|
46
|
|
-#define CONFIG_HEAP_START ((caddr_t)&_lm_heap_start)
|
|
|
47
|
+#define CONFIG_HEAP_START ((void *)&_lm_heap_start)
|
|
47
|
48
|
#endif
|
|
48
|
49
|
#ifndef CONFIG_HEAP_END
|
|
49
|
50
|
extern char _lm_heap_end;
|
|
50
|
|
-#define CONFIG_HEAP_END ((caddr_t)&_lm_heap_end)
|
|
|
51
|
+#define CONFIG_HEAP_END ((void *)&_lm_heap_end)
|
|
51
|
52
|
#endif
|
|
52
|
53
|
|
|
53
|
54
|
/*
|
|
|
@@ -56,9 +57,9 @@ extern char _lm_heap_end;
|
|
56
|
57
|
* Get incr bytes more RAM (for use by the heap). malloc() and
|
|
57
|
58
|
* friends call this function behind the scenes.
|
|
58
|
59
|
*/
|
|
59
|
|
-caddr_t _sbrk(int incr) {
|
|
60
|
|
- static caddr_t pbreak = NULL; /* current program break */
|
|
61
|
|
- caddr_t ret;
|
|
|
60
|
+void *_sbrk(int incr) {
|
|
|
61
|
+ static void * pbreak = NULL; /* current program break */
|
|
|
62
|
+ void * ret;
|
|
62
|
63
|
|
|
63
|
64
|
if (pbreak == NULL) {
|
|
64
|
65
|
pbreak = CONFIG_HEAP_START;
|
|
|
@@ -67,7 +68,7 @@ caddr_t _sbrk(int incr) {
|
|
67
|
68
|
if ((CONFIG_HEAP_END - pbreak < incr) ||
|
|
68
|
69
|
(pbreak - CONFIG_HEAP_START < -incr)) {
|
|
69
|
70
|
errno = ENOMEM;
|
|
70
|
|
- return (caddr_t)-1;
|
|
|
71
|
+ return (void *)-1;
|
|
71
|
72
|
}
|
|
72
|
73
|
|
|
73
|
74
|
ret = pbreak;
|