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:
parent
92babce456
commit
47e600b575
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=126592
@ -163,8 +163,7 @@ static __inline struct file *
|
|||||||
fget_locked(struct filedesc *fdp, int fd)
|
fget_locked(struct filedesc *fdp, int fd)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* u_int cast checks for negative descriptors. */
|
return (fd < 0 || fd >= fdp->fd_nfiles ? NULL : fdp->fd_ofiles[fd]);
|
||||||
return ((u_int)fd >= (u_int)fdp->fd_nfiles ? NULL : fdp->fd_ofiles[fd]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern struct mtx fdesc_mtx;
|
extern struct mtx fdesc_mtx;
|
||||||
|
Loading…
Reference in New Issue
Block a user