Don't manually optimize for 20 year old compilers by casting to u_int

to get a free check for negative ints.  Rev.1.35 got my request to
remove the cast mostly backwards.
This commit is contained in:
Bruce Evans 2004-03-04 11:20:02 +00:00
parent 92babce456
commit 47e600b575

View File

@ -163,8 +163,7 @@ static __inline struct file *
fget_locked(struct filedesc *fdp, int fd)
{
/* u_int cast checks for negative descriptors. */
return ((u_int)fd >= (u_int)fdp->fd_nfiles ? NULL : fdp->fd_ofiles[fd]);
return (fd < 0 || fd >= fdp->fd_nfiles ? NULL : fdp->fd_ofiles[fd]);
}
extern struct mtx fdesc_mtx;