source: trunk/libs/newlib/src/libgloss/testsuite/libgloss.all/memory.c @ 688

Last change on this file since 688 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 683 bytes
Line 
1/* WinBond bug report
2
3   malloc() returns 0x0.
4
5   test the memory calls. These test sbrk(), which is part of glue.c
6   for most architectures.
7 */
8
9#include <stdio.h>
10#define BUFSIZE 80
11
12main()
13{
14  char *buf;
15  char *tmp;
16  char *result;
17
18  /* see if we can get some memory */
19  buf = (char *)malloc(BUFSIZE);
20  if (buf != 0x0) {
21    pass ("malloc");
22  } else {
23    fail ("malloc");
24  }
25
26  /* see if we can realloc it */
27  tmp = buf;
28  result = (char *)realloc (buf, BUFSIZE+100);
29   if ((buf != 0x0) && (result != 0x0)) {
30    pass ("realloc");
31  } else {
32    fail ("realloc");
33  }
34   
35  /* see if we can free it up. FIXME: how to test free ?*/
36  free (buf);
37  fflush (stdout);
38}
Note: See TracBrowser for help on using the repository browser.