Subject: code in kern_proc.c
To: None <tech-kern@netbsd.org>
From: Ian Zagorskih <ianzag@megasignal.com>
List: tech-kern
Date: 12/22/2003 22:09:18
Hey all,
Just a cut from /sys/kern/kern_proc.c
--- cut ---
/*
* Locate a process by number
*/
struct proc *
pfind(pid)
pid_t pid;
{
struct proc *p;
proclist_lock_read();
for (p = PIDHASH(pid)->lh_first; p != 0; p = p->p_hash.le_next)
if (p->p_pid == pid)
goto out;
out:
proclist_unlock_read();
return (p);
}
--- cut ---
I'm wondering if this "goto out" is really required here ? I.e. isn't code
like:
for (p = PIDHASH(pid)->lh_first; p != 0; p = p->p_hash.le_next)
if (p->p_pid == pid) break;
..does the same ? I'm not complaining about "goto is bad || good" just
wondering if i'm missing something and this goto really does smth that break
cannot :)
Thanks.
---------
JSC Novosibirsk Geophysical Equipment Development Center
http://www.megasignal.com