Remove dups from cfdata via marking algorithm
authorniklas <niklas@openbsd.org>
Wed, 11 Dec 1996 22:36:14 +0000 (22:36 +0000)
committerniklas <niklas@openbsd.org>
Wed, 11 Dec 1996 22:36:14 +0000 (22:36 +0000)
usr.sbin/config/pack.c
usr.sbin/config/sem.c

index bbac10d..41dde9b 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: pack.c,v 1.6 1996/12/11 13:00:13 niklas Exp $ */
+/*     $OpenBSD: pack.c,v 1.7 1996/12/11 22:36:14 niklas Exp $ */
 /*     $NetBSD: pack.c,v 1.5 1996/08/31 21:15:11 mycroft Exp $ */
 
 /*
@@ -176,9 +176,12 @@ packdevi()
                 * For each instance of each attachment, add or collapse
                 * all its aliases.
                 */
-               for (i = d->d_ihead; i != NULL; i = i->i_bsame) {
+               for (i = d->d_ihead; i != NULL; i = i->i_asame) {
                        m = n;
                        for (l = i; l != NULL; l = l->i_alias) {
+                               /* Skip if we already handled this one.  */
+                               if (l->i_cfindex >= 0)
+                                       continue;
                                l->i_pvlen = 0;
                                l->i_pvoff = -1;
                                l->i_locoff = -1;
index 99850be..b4cb048 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: sem.c,v 1.6 1996/10/23 22:38:00 niklas Exp $  */
+/*     $OpenBSD: sem.c,v 1.7 1996/12/11 22:36:15 niklas Exp $  */
 /*     $NetBSD: sem.c,v 1.9 1996/08/31 21:15:15 mycroft Exp $  */
 
 /*
@@ -725,6 +725,7 @@ newdevi(name, unit, d)
        i->i_atdeva = NULL;
        i->i_locs = NULL;
        i->i_cfflags = 0;
+       i->i_cfindex = -1;
        i->i_lineno = currentline();
        if (unit >= d->d_umax)
                d->d_umax = unit + 1;