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

Diff for /src/usr.bin/tsort/tsort.c between version 1.23 and 1.24

version 1.23, 2014/05/12 19:11:20 version 1.24, 2014/10/11 03:57:13
Line 149 
Line 149 
 static void *hash_calloc(size_t, size_t, void *);  static void *hash_calloc(size_t, size_t, void *);
 static void hash_free(void *, void *);  static void hash_free(void *, void *);
 static void* entry_alloc(size_t, void *);  static void* entry_alloc(size_t, void *);
 static void *emalloc(size_t);  static void *ereallocarray(void *, size_t, size_t);
 static void *emem(void *);  static void *emem(void *);
 #define DEBUG_TRAVERSE 0  #define DEBUG_TRAVERSE 0
 static struct ohash_info node_info = {  static struct ohash_info node_info = {
Line 187 
Line 187 
 static void *  static void *
 entry_alloc(size_t s, void *u UNUSED)  entry_alloc(size_t s, void *u UNUSED)
 {  {
         return emalloc(s);          return ereallocarray(NULL, 1, s);
 }  }
   
 static void *  static void *
 emalloc(size_t s)  ereallocarray(void *p, size_t n, size_t s)
 {  {
         return emem(malloc(s));          return emem(reallocarray(p, n, s));
 }  }
   
   
Line 290 
Line 290 
                         return;                          return;
         }          }
         b->refs++;          b->refs++;
         l = emalloc(sizeof(struct link));          l = ereallocarray(NULL, 1, sizeof(struct link));
         l->node = b;          l->node = b;
         l->next = a->arcs;          l->next = a->arcs;
         a->arcs = l;          a->arcs = l;
Line 529 
Line 529 
         struct node *n;          struct node *n;
         unsigned int i;          unsigned int i;
   
         heap->t = emalloc(sizeof(struct node *) * ohash_entries(hash));          heap->t = ereallocarray(NULL, ohash_entries(hash),
         remaining->t = emalloc(sizeof(struct node *) * ohash_entries(hash));              sizeof(struct node *));
           remaining->t = ereallocarray(NULL, ohash_entries(hash),
               sizeof(struct node *));
         heap->entries = 0;          heap->entries = 0;
         remaining->entries = 0;          remaining->entries = 0;
   

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24