summaryrefslogtreecommitdiff
path: root/avr/xmalloc.c
diff options
context:
space:
mode:
authorLeo C2014-08-12 12:35:28 +0200
committerLeo C2014-08-12 12:35:28 +0200
commitd684c21619905153eff68c43927207248925f6c2 (patch)
treec4bfb04a20512679103c6ad39fd9885dea6d9e76 /avr/xmalloc.c
parent9b6b4b31e8cb284ad6a68fe16d458e36bbfb46fa (diff)
downloadz180-stamp-d684c21619905153eff68c43927207248925f6c2.zip
New U-Boot like AVR main program.
Uses U-Boot source code taken from: git://git.denx.de/u-boot.git
Diffstat (limited to 'avr/xmalloc.c')
-rw-r--r--avr/xmalloc.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/avr/xmalloc.c b/avr/xmalloc.c
new file mode 100644
index 0000000..9bf2684
--- /dev/null
+++ b/avr/xmalloc.c
@@ -0,0 +1,27 @@
+#include <stdlib.h>
+
+#include "debug.h"
+#include "xmalloc.h"
+
+void* xmalloc(size_t size)
+{
+ void *p;
+
+ p = malloc(size);
+
+ if (p == NULL)
+ debug("*** Out of memory!\n");
+
+ return p;
+}
+
+
+void* xrealloc(void *p, size_t size)
+{
+ p = realloc(p, size);
+
+ if (p == NULL)
+ debug("*** Out of memory!\n");
+
+ return p;
+}