[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.24 and 1.25

version 1.24, 2014/10/11 03:57:13 version 1.25, 2015/07/21 07:13:59
Line 158 
Line 158 
   
 int main(int, char *[]);  int main(int, char *[]);
   
   
 /***  /***
  *** Memory handling.   *** Memory handling.
  ***/   ***/
Line 238 
Line 237 
                 n = ohash_insert(h, i, new_node(start, end));                  n = ohash_insert(h, i, new_node(start, end));
         return n;          return n;
 }  }
   
 #ifdef DEBUG  #ifdef DEBUG
 static void  static void
 dump_node(struct node *n)  dump_node(struct node *n)
Line 262 
Line 261 
         for (i = 0; i < a->entries; i++)          for (i = 0; i < a->entries; i++)
                 dump_node(a->t[i]);                  dump_node(a->t[i]);
 }  }
   
 static void  static void
 dump_hash(struct ohash *h)  dump_hash(struct ohash *h)
 {  {
Line 273 
Line 272 
                 dump_node(n);                  dump_node(n);
 }  }
 #endif  #endif
   
   
 /***  /***
  *** Reading data.   *** Reading data.
  ***/   ***/
Line 307 
Line 305 
   
         toggle = 1;          toggle = 1;
         a = NULL;          a = NULL;
   
         while ((str = fgetln(f, &size)) != NULL) {          while ((str = fgetln(f, &size)) != NULL) {
                 char *sentinel;                  char *sentinel;
   
Line 438 
Line 436 
         }          }
         return n;          return n;
 }  }
   
 #define ENQUEUE(h, n) do {                      \  #define ENQUEUE(h, n) do {                      \
         if (hints_flag)                         \          if (hints_flag)                         \
                 enqueue((h), (n));              \                  enqueue((h), (n));              \
Line 558 
Line 556 
         assert(h->entries != 0);          assert(h->entries != 0);
         for (i = 0; i < h->entries; i++) {          for (i = 0; i < h->entries; i++) {
                 struct node *n = h->t[i];                  struct node *n = h->t[i];
                 /* No need to look further. */                  /* No need to look further. */
                 if (n->refs == 1)                  if (n->refs == 1)
                         return n;                          return n;
                 if (n->refs != 0 && n->refs < best) {                  if (n->refs != 0 && n->refs < best) {
Line 569 
Line 567 
         assert(u != NULL);          assert(u != NULL);
         return u;          return u;
 }  }
   
 /*  Retrieve the node with the smallest order.  */  /*  Retrieve the node with the smallest order.  */
 static struct node *  static struct node *
 find_smallest_node(struct array *h)  find_smallest_node(struct array *h)
Line 733 
Line 731 
                         n = n->from;                          n = n->from;
                         if (!n)                          if (!n)
                                 return max;                                  return max;
                         o--;                          o--;
                 }                  }
         }          }
 }  }
Line 785 
Line 783 
                         o = traverse_node(n, o, c);                          o = traverse_node(n, o, c);
                 }                  }
         }          }
   
         assert(c->entries != 0);          assert(c->entries != 0);
         n = c->t[0];          n = c->t[0];
         best = n->refs;          best = n->refs;

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