Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ddb use a for loop instead of goto.
details: https://anonhg.NetBSD.org/src/rev/da62224058c0
branches: trunk
changeset: 515004:da62224058c0
user: chs <chs%NetBSD.org@localhost>
date: Sat Sep 15 18:20:53 2001 +0000
description:
use a for loop instead of goto.
diffstat:
sys/ddb/db_xxx.c | 24 +++++++++++-------------
1 files changed, 11 insertions(+), 13 deletions(-)
diffs (63 lines):
diff -r d94bd13b80c9 -r da62224058c0 sys/ddb/db_xxx.c
--- a/sys/ddb/db_xxx.c Sat Sep 15 18:03:35 2001 +0000
+++ b/sys/ddb/db_xxx.c Sat Sep 15 18:20:53 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_xxx.c,v 1.13 2001/09/11 04:32:19 thorpej Exp $ */
+/* $NetBSD: db_xxx.c,v 1.14 2001/09/15 18:20:53 chs Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -110,7 +110,7 @@
int i;
char *mode;
struct proc *p, *pp;
- struct timeval tv[3];
+ struct timeval tv[2];
const struct proclist_desc *pd;
if (modif[0] == 0)
@@ -144,11 +144,12 @@
/* XXX LOCKING XXX */
pd = proclists;
- loop:
- for (p = LIST_FIRST(pd->pd_list); p != NULL;
- p = LIST_NEXT(p, p_list)) {
- pp = p->p_pptr;
- if (p->p_stat) {
+ for (pd = proclists; pd->pd_list != NULL; pd++) {
+ LIST_FOREACH(p, pd->pd_list, p_list) {
+ pp = p->p_pptr;
+ if (p->p_stat == 0) {
+ continue;
+ }
db_printf("%c%-10d", " >"[curproc == p], p->p_pid);
@@ -170,13 +171,13 @@
case 'w':
db_printf("%10s %8s %4d", p->p_comm,
p->p_emul->e_name,p->p_priority);
- calcru(p, tv+0, tv+1, tv+2);
- for(i = 0; i < 2; ++i) {
+ calcru(p, &tv[0], &tv[1], NULL);
+ for (i = 0; i < 2; ++i) {
db_printf("%4ld.%1ld",
(long)tv[i].tv_sec,
(long)tv[i].tv_usec/100000);
}
- if(p->p_wchan && p->p_wmesg) {
+ if (p->p_wchan && p->p_wmesg) {
db_printf(" %-12s", p->p_wmesg);
db_printsym((db_expr_t)p->p_wchan,
DB_STGY_XTRN, db_printf);
@@ -187,9 +188,6 @@
}
}
}
- pd++;
- if (pd->pd_list != NULL)
- goto loop;
}
void
Home |
Main Index |
Thread Index |
Old Index