diff options
author | ache <ache@FreeBSD.org> | 1995-08-01 23:38:00 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1995-08-01 23:38:00 +0000 |
commit | 8d9dc3960243a7cc728492b78e799310c3ba13e5 (patch) | |
tree | 08d474e5647d3ab4b67b075909bf81a4ee50fbc2 /sys/kern/tty.c | |
parent | caec2f2ae9e16e3f355b8b1636956da4f12e7c24 (diff) | |
download | FreeBSD-src-8d9dc3960243a7cc728492b78e799310c3ba13e5.zip FreeBSD-src-8d9dc3960243a7cc728492b78e799310c3ba13e5.tar.gz |
Optimize a bit valid speed search using fact that speed table sorted
Submitted by:
Obtained from:
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r-- | sys/kern/tty.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 81874f8..dc5fe3f 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)tty.c 8.8 (Berkeley) 1/21/94 - * $Id: tty.c,v 1.66 1995/07/31 22:50:01 bde Exp $ + * $Id: tty.c,v 1.67 1995/08/01 23:27:34 ache Exp $ */ /*- @@ -834,11 +834,15 @@ ttioctl(tp, cmd, data, flag) for (i = MAX_SPEED; i >= 0; i--) if (t->c_ispeed == validspeed[i]) break; + else if (t->c_ispeed > validspeed[i]) + return (EINVAL); if (i < 0) return (EINVAL); for (i = MAX_SPEED; i >= 0; i--) if (t->c_ospeed == validspeed[i]) break; + else if (t->c_ospeed > validspeed[i]) + return (EINVAL); if (i < 0) return (EINVAL); |