From 4d912032e473d769f2f66a9af964c5a0124f99eb Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Tue, 1 May 2001 20:36:58 +0000 Subject: 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 ! --- usr.bin/tsort/tsort.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'usr.bin') 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. */ -- cgit v1.2.3