/[man-db]/man-db/lib/xmalloc.c
ViewVC logotype

Diff of /man-db/lib/xmalloc.c

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

revision 1.1.1.1 by cjwatson, Thu Apr 26 17:31:22 2001 UTC revision 1.2 by cjwatson, Thu May 1 18:14:11 2003 UTC
# Line 19  Line 19 
19  #  include "config.h"  #  include "config.h"
20  #endif  #endif
21    
 #if __STDC__  
 #define VOID void  
 #else  
 #define VOID char  
 #endif  
   
22  #include <sys/types.h>  #include <sys/types.h>
23    
24  #if STDC_HEADERS  #if STDC_HEADERS
25  #include <stdlib.h>  #include <stdlib.h>
26  #else  #else
27  VOID *malloc ();  void *malloc ();
28  VOID *realloc ();  void *realloc ();
29  void free ();  void free ();
30  #endif  #endif
31    
# Line 49  void error (int, int, const char *, ...) Line 43  void error (int, int, const char *, ...)
43  void error ();  void error ();
44  #endif  #endif
45    
46  static VOID *  static void *
47  fixup_null_alloc (n)  fixup_null_alloc (size_t n)
      size_t n;  
48  {  {
49    VOID *p;    void *p;
50    
51    p = 0;    p = 0;
52    if (n == 0)    if (n == 0)
# Line 65  fixup_null_alloc (n) Line 58  fixup_null_alloc (n)
58    
59  /* Allocate N bytes of memory dynamically, with error checking.  */  /* Allocate N bytes of memory dynamically, with error checking.  */
60    
61  VOID *  void *
62  xmalloc (n)  xmalloc (size_t n)
      size_t n;  
63  {  {
64    VOID *p;    void *p;
65    
66    p = malloc (n);    p = malloc (n);
67    if (p == 0)    if (p == 0)
# Line 81  xmalloc (n) Line 73  xmalloc (n)
73     with error checking.     with error checking.
74     If P is NULL, run xmalloc.  */     If P is NULL, run xmalloc.  */
75    
76  VOID *  void *
77  xrealloc (p, n)  xrealloc (void *p, size_t n)
      VOID *p;  
      size_t n;  
78  {  {
79    if (p == 0)    if (p == 0)
80      return xmalloc (n);      return xmalloc (n);

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

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26