[BACK]Return to memory.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / make

Diff for /src/usr.bin/make/memory.c between version 1.2 and 1.3

version 1.2, 2003/06/03 02:56:12 version 1.3, 2004/04/07 13:11:36
Line 52 
Line 52 
  *      malloc, but die on error.   *      malloc, but die on error.
  */   */
 void *  void *
 emalloc(len)  emalloc(size_t size)
         size_t len;  
 {  {
         void *p;          void *p;
   
         if ((p = malloc(len)) == NULL)          if ((p = malloc(size)) == NULL)
                 enomem(len);                  enomem(size);
         return p;          return p;
 }  }
   
Line 67 
Line 66 
  *      strdup, but die on error.   *      strdup, but die on error.
  */   */
 char *  char *
 estrdup(str)  estrdup(const char *str)
         const char *str;  
 {  {
         char *p;          char *p;
         size_t size;          size_t size;
Line 85 
Line 83 
  *      realloc, but die on error.   *      realloc, but die on error.
  */   */
 void *  void *
 erealloc(ptr, size)  erealloc(void *ptr, size_t size)
         void *ptr;  
         size_t size;  
 {  {
         if ((ptr = realloc(ptr, size)) == NULL)          if ((ptr = realloc(ptr, size)) == NULL)
                 enomem(size);                  enomem(size);
Line 95 
Line 91 
 }  }
   
 void *  void *
 ecalloc(s1, s2)  ecalloc(size_t s1, size_t s2)
         size_t s1;  
         size_t s2;  
 {  {
         void *p;          void *p;
   
Line 108 
Line 102 
   
 /* Support routines for hash tables.  */  /* Support routines for hash tables.  */
 void *  void *
 hash_alloc(s, u)  hash_alloc(size_t s, void *u UNUSED)
         size_t s;  
         void *u         UNUSED;  
 {  {
         return ecalloc(s, 1);          return ecalloc(s, 1);
 }  }
   
 void  void
 hash_free(p, s, u)  hash_free(void *p, size_t s UNUSED, void *u UNUSED)
         void *p;  
         size_t s        UNUSED;  
         void *u         UNUSED;  
 {  {
         free(p);          free(p);
 }  }
   
 void *  void *
 element_alloc(s, u)  element_alloc(size_t s, void *u UNUSED)
         size_t s;  
         void *u         UNUSED;  
 {  {
         return emalloc(s);          return emalloc(s);
 }  }
Line 139 
Line 126 
  *      die when out of memory.   *      die when out of memory.
  */   */
 void  void
 enomem(size)  enomem(size_t size)
         size_t size;  
 {  {
         fprintf(stderr, "make: %s (%lu)\n", strerror(errno), (u_long)size);          fprintf(stderr, "make: %s (%lu)\n", strerror(errno), (u_long)size);
         exit(2);          exit(2);
Line 151 
Line 137 
  *      change environment, die on error.   *      change environment, die on error.
  */   */
 void  void
 esetenv(name, value)  esetenv(const char *name, const char *value)
         const char *name;  
         const char *value;  
 {  {
         if (setenv(name, value, 1) == 0)          if (setenv(name, value, 1) == 0)
             return;              return;
Line 168 
Line 152 
  *      Remove a file carefully, avoiding directories.   *      Remove a file carefully, avoiding directories.
  */   */
 int  int
 eunlink(file)  eunlink(const char *file)
         const char *file;  
 {  {
         struct stat st;          struct stat st;
   

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