Module Name: src
Committed By: christos
Date: Tue Nov 28 15:31:33 UTC 2017
Modified Files:
src/usr.bin/config: main.c
Log Message:
- make the level computation consistent
- keep going only if things changed.
To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/usr.bin/config/main.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/config/main.c
diff -u src/usr.bin/config/main.c:1.96 src/usr.bin/config/main.c:1.97
--- src/usr.bin/config/main.c:1.96 Sun Nov 26 19:25:46 2017
+++ src/usr.bin/config/main.c Tue Nov 28 10:31:33 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.96 2017/11/27 00:25:46 christos Exp $ */
+/* $NetBSD: main.c,v 1.97 2017/11/28 15:31:33 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: main.c,v 1.96 2017/11/27 00:25:46 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.97 2017/11/28 15:31:33 christos Exp $");
#ifndef MAKE_BOOTSTRAP
#include <sys/cdefs.h>
@@ -1876,21 +1876,22 @@ addlevelparent(struct devbase *d, struct
struct devbase *p;
if (d == parent) {
- if (d->d_level++ > 1)
+ if (d->d_level > 1)
return 0;
return 1;
}
if (d->d_levelparent) {
- if (d->d_level++ > 1)
+ if (d->d_level > 1)
return 0;
return 1;
}
for (p = parent; p != NULL; p = p->d_levelparent)
- if (d == p && d->d_level++ > 1)
+ if (d == p && d->d_level > 1)
return 0;
d->d_levelparent = p ? p : &root;
+ d->d_level++;
return 1;
}
@@ -1926,6 +1927,7 @@ do_kill_orphans(struct devbase *d, struc
}
} else {
int seen = 0;
+ int changed = 0;
for (i = d->d_ihead; i != NULL; i = i->i_bsame) {
for (j = i; j != NULL; j = j->i_alias) {
@@ -1958,6 +1960,7 @@ do_kill_orphans(struct devbase *d, struc
seen = 1;
continue;
}
+ changed |= j->i_active != state;
j->i_active = active = state;
if (p != NULL) {
if (state == DEVI_ACTIVE ||
@@ -1997,8 +2000,9 @@ do_kill_orphans(struct devbase *d, struc
CFGDBG(5, "`%s' at '%s' ignored", d->d_name,
parent ? parent->d_name : "(root)");
- }
- }
+ } else if (!changed)
+ goto out;
+ }
}
for (al = d->d_attrs; al != NULL; al = al->al_next) {