summaryrefslogtreecommitdiffstats
path: root/sys/compat/svr4
diff options
context:
space:
mode:
authornewton <newton@FreeBSD.org>1999-12-12 10:28:30 +0000
committernewton <newton@FreeBSD.org>1999-12-12 10:28:30 +0000
commitfe01fbadb8a6de3b79d5b9a7bd3ce5f1bc85d67d (patch)
tree958dafa82b51e61152b4adfe92c32f5be4c66621 /sys/compat/svr4
parent2fa1d32877711ee812844a7181e59d10427bcd6a (diff)
downloadFreeBSD-src-fe01fbadb8a6de3b79d5b9a7bd3ce5f1bc85d67d.zip
FreeBSD-src-fe01fbadb8a6de3b79d5b9a7bd3ce5f1bc85d67d.tar.gz
Avoid excessive redundancy in svr4_sys_getmsg() and svr4_sys_putmsg():
Only look up the provided descriptor in fd_ofiles[] once. Submitted by: Ville-Pertti Keinone <will@iki.fi>
Diffstat (limited to 'sys/compat/svr4')
-rw-r--r--sys/compat/svr4/svr4_stream.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/compat/svr4/svr4_stream.c b/sys/compat/svr4/svr4_stream.c
index d495cc6..aa27ac0 100644
--- a/sys/compat/svr4/svr4_stream.c
+++ b/sys/compat/svr4/svr4_stream.c
@@ -1703,8 +1703,9 @@ svr4_sys_putmsg(p, uap)
caddr_t sg;
retval = p->p_retval;
- if ((u_int)SCARG(uap, fd) >= fdp->fd_nfiles ||
- (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL) {
+ fp = fdp->fd_ofiles[SCARG(uap, fd)];
+
+ if (((u_int)SCARG(uap, fd) >= fdp->fd_nfiles) || (fp == NULL)) {
#ifdef DEBUG_SVR4
uprintf("putmsg: bad fp\n");
#endif
@@ -1716,8 +1717,7 @@ svr4_sys_putmsg(p, uap)
SCARG(uap, dat), SCARG(uap, flags));
#endif /* DEBUG_SVR4 */
- if ((u_int)SCARG(uap, fd) >= fdp->fd_nfiles ||
- (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL) {
+ if (((u_int)SCARG(uap, fd) >= fdp->fd_nfiles) || (fp == NULL)) {
#ifdef DEBUG_SVR4
uprintf("putmsg: bad fp(2)\n");
#endif
@@ -1891,8 +1891,9 @@ svr4_sys_getmsg(p, uap)
caddr_t sg;
retval = p->p_retval;
- if ((u_int)SCARG(uap, fd) >= fdp->fd_nfiles ||
- (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL)
+ fp = fdp->fd_ofiles[SCARG(uap, fd)];
+
+ if (((u_int)SCARG(uap, fd) >= fdp->fd_nfiles) || (fp == NULL))
return EBADF;
memset(&sc, 0, sizeof(sc));
@@ -1902,8 +1903,7 @@ svr4_sys_getmsg(p, uap)
SCARG(uap, dat), 0);
#endif /* DEBUG_SVR4 */
- if ((u_int)SCARG(uap, fd) >= fdp->fd_nfiles ||
- (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL)
+ if (((u_int)SCARG(uap, fd) >= fdp->fd_nfiles) || (fp == NULL))
return EBADF;
if (SCARG(uap, ctl) != NULL) {
OpenPOWER on IntegriCloud