/[MITgcm]/MITgcm/tools/mpack-1.6/xmalloc.c
ViewVC logotype

Diff of /MITgcm/tools/mpack-1.6/xmalloc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1 by edhill, Tue Aug 26 20:45:25 2003 UTC revision 1.2 by edhill, Tue Nov 23 15:52:35 2004 UTC
# Line 24  Line 24 
24   */   */
25  #include <stdio.h>  #include <stdio.h>
26  #include <string.h>  #include <string.h>
27  extern char *malloc(), *realloc();  /* 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");
# Line 43  char *xrealloc (char *ptr, int size) Line 43  char *xrealloc (char *ptr, int size)
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");

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.22