[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.9 and 1.10

version 1.9, 2013/04/23 14:32:53 version 1.10, 2014/05/12 19:11:19
Line 104 
Line 104 
 }  }
   
 void *  void *
 emult_realloc(void *ptr, size_t s1, size_t s2)  ereallocarray(void *ptr, size_t s1, size_t s2)
 {  {
         size_t size;          if ((ptr = reallocarray(ptr, s1, s2)) == NULL)
   
         if (s1 && SIZE_MAX / s1 < s2) {  
                 errno = ENOMEM;  
                 enocmem(s1, s2);                  enocmem(s1, s2);
         }  
         size = s1 * s2;  
         if ((ptr = realloc(ptr, size)) == NULL)  
                 enocmem(s1, s2);  
         return ptr;          return ptr;
 }  }
   
 /* Support routines for hash tables.  */  /* Support routines for hash tables.  */
 void *  void *
 hash_alloc(size_t s, void *u UNUSED)  hash_calloc(size_t n, size_t s, void *u UNUSED)
 {  {
         return ecalloc(s, 1);          return ecalloc(n, s);
 }  }
   
 void  void
 hash_free(void *p, size_t s UNUSED, void *u UNUSED)  hash_free(void *p, void *u UNUSED)
 {  {
         free(p);          free(p);
 }  }

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10