23 |
* SOFTWARE. |
* SOFTWARE. |
24 |
*/ |
*/ |
25 |
#include <stdio.h> |
#include <stdio.h> |
|
#include <stdlib.h> |
|
26 |
#include <string.h> |
#include <string.h> |
27 |
|
/* extern char *malloc(), *realloc(); */ |
28 |
|
|
29 |
char *xmalloc (int size) |
char *xmalloc (int size) |
30 |
{ |
{ |
31 |
char *ret; |
char *ret; |
32 |
|
|
33 |
if ((ret = malloc((unsigned) size))) |
if (ret = (char *)malloc((unsigned) size)) |
34 |
return ret; |
return ret; |
35 |
|
|
36 |
fprintf(stderr, "Memory exhausted\n"); |
fprintf(stderr, "Memory exhausted\n"); |
43 |
char *ret; |
char *ret; |
44 |
|
|
45 |
/* xrealloc (NULL, size) behaves like xmalloc (size), as in ANSI C */ |
/* xrealloc (NULL, size) behaves like xmalloc (size), as in ANSI C */ |
46 |
if ((ret = !ptr ? malloc ((unsigned) size) : realloc (ptr, (unsigned) size))) |
if (ret = !ptr ? ((char *)malloc ((unsigned) size)) : ((char *)realloc (ptr, (unsigned) size))) |
47 |
return ret; |
return ret; |
48 |
|
|
49 |
fprintf(stderr, "Memory exhausted\n"); |
fprintf(stderr, "Memory exhausted\n"); |