diff options
author | 2007-10-05 12:48:29 +0000 | |
---|---|---|
committer | 2007-10-05 12:48:29 +0000 | |
commit | 95c842c38c5d37cd13945231dbe07a173e7c7d16 (patch) | |
tree | fcbdc893cce6f84bf4c132edcf15dacab2c52e3c | |
parent | Disable fiber/copper auto-selection on the 88E1111 if it is in RGMII mode, to (diff) | |
download | wireguard-openbsd-95c842c38c5d37cd13945231dbe07a173e7c7d16.tar.xz wireguard-openbsd-95c842c38c5d37cd13945231dbe07a173e7c7d16.zip |
optimize a "not so bright" piece of code. Reduces compilation time on my
evil test case from > 3m to < 1s. ok ragge@
-rw-r--r-- | usr.bin/pcc/cc/ccom/init.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/pcc/cc/ccom/init.c b/usr.bin/pcc/cc/ccom/init.c index 3813cf8369c..ec721195479 100644 --- a/usr.bin/pcc/cc/ccom/init.c +++ b/usr.bin/pcc/cc/ccom/init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init.c,v 1.8 2007/09/29 15:19:13 otto Exp $ */ +/* $OpenBSD: init.c,v 1.9 2007/10/05 12:48:29 otto Exp $ */ /* * Copyright (c) 2004, 2007 Anders Magnusson (ragge@ludd.ltu.se). @@ -185,16 +185,19 @@ getll(void) /* * Return structure containing off bitnumber. * Allocate more entries, if needed. - * This is not bright implemented. */ static struct llist * setll(OFFSZ off) { - struct llist *ll; + struct llist *ll = NULL; /* Ensure that we have enough entries */ while (off >= basesz * numents) - (void)getll(); + ll = getll(); + + if (ll != NULL && ll->begsz <= off && ll->begsz + basesz > off) + return ll; + SLIST_FOREACH(ll, &lpole, next) if (ll->begsz <= off && ll->begsz + basesz > off) break; |