Files
mips/_old/src/memory.c
T
jens 26291bca3d - initial import
git-svn-id: http://moon:8086/svn/mips@1 a8ebac50-d88d-4704-bea3-6648445a41b3
2014-07-20 15:01:37 +00:00

49 lines
793 B
C

/* WinBond bug report
malloc() returns 0x0.
test the memory calls. These test sbrk(), which is part of glue.c
for most architectures.
*/
#include <stdio.h>
#define BUFSIZE 80
void pass(char *str)
{
printf("%s - Passed\n", str);
}
void fail(char *str)
{
printf("%s - Failed\n", str);
}
main()
{
char *buf;
char *tmp;
char *result;
/* see if we can get some memory */
buf = (char *)malloc(BUFSIZE);
if (buf != 0x0) {
pass ("malloc");
} else {
fail ("malloc");
}
/* see if we can realloc it */
tmp = buf;
result = (char *)realloc (buf, BUFSIZE+100);
if ((buf != 0x0) && (result != 0x0)) {
pass ("realloc");
} else {
fail ("realloc");
}
/* see if we can free it up. FIXME: how to test free ?*/
free (buf);
fflush (stdout);
}