summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2001-05-01 20:36:58 +0000
committerMarc Espie <espie@cvs.openbsd.org>2001-05-01 20:36:58 +0000
commit4d912032e473d769f2f66a9af964c5a0124f99eb (patch)
tree260aff11e99349436a6c2c26217955226201a6cc /usr.bin
parentd2074c2c4aaf756bec8242b625074b0b949295b7 (diff)
Revert stupid buggy optimisation.
Another Murphy's law: complicated code always works right the first time. Stupid dumb details, on the other hand. Of course we can't share both arrays, as we don't know how they will grow, duh !
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tsort/tsort.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/tsort/tsort.c b/usr.bin/tsort/tsort.c
index a5006d753d7..ab7aff9d8f7 100644
--- a/usr.bin/tsort/tsort.c
+++ b/usr.bin/tsort/tsort.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tsort.c,v 1.8 2001/04/30 21:03:55 espie Exp $ */
+/* $OpenBSD: tsort.c,v 1.9 2001/05/01 20:36:57 espie Exp $ */
/* ex:ts=8 sw=4:
*/
@@ -579,9 +579,9 @@ split_nodes(hash, heap, remaining)
struct node *n;
unsigned int i;
- unsigned int total = ohash_entries(hash);
heap->t = emalloc(sizeof(struct node *) * ohash_entries(hash));
+ remaining->t = emalloc(sizeof(struct node *) * ohash_entries(hash));
heap->entries = 0;
remaining->entries = 0;
@@ -589,9 +589,8 @@ split_nodes(hash, heap, remaining)
if (n->refs == 0)
heap->t[heap->entries++] = n;
else
- heap->t[total-1-remaining->entries++] = n;
+ remaining->t[remaining->entries++] = n;
}
- remaining->t = heap->t + heap->entries;
}
/* Good point to break a cycle: live node with as few refs as possible. */