summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-09-28 13:03:57 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-09-28 13:03:57 +0000
commit671f0d97f2baa9fb0be6a265f4dbeb22af7d7c09 (patch)
tree76a968e0892877779968bfe8e45858ee320b10c4 /sys
parente3754c58c90da1b73c783b2c2486bbc1e96a9f12 (diff)
QBITS is always defined, no point in having all those cofusing ifdefs.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/tty_subr.c51
1 files changed, 3 insertions, 48 deletions
diff --git a/sys/kern/tty_subr.c b/sys/kern/tty_subr.c
index 0f28b0ffef2..35c193ebf97 100644
--- a/sys/kern/tty_subr.c
+++ b/sys/kern/tty_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty_subr.c,v 1.14 2001/09/28 09:14:07 art Exp $ */
+/* $OpenBSD: tty_subr.c,v 1.15 2001/09/28 13:03:56 art Exp $ */
/* $NetBSD: tty_subr.c,v 1.13 1996/02/09 19:00:43 christos Exp $ */
/*
@@ -42,30 +42,16 @@
#include <sys/malloc.h>
/*
- * At compile time, choose:
- * There are two ways the TTY_QUOTE bit can be stored. If QBITS is
- * defined we allocate an array of bits -- 1/8th as much memory but
- * setbit(), clrbit(), and isset() take more cpu. If QBITS is
- * undefined, we just use an array of bytes.
- *
* If TTY_QUOTE functionality isn't required by a line discipline,
* it can free c_cq and set it to NULL. This speeds things up,
* and also does not use any extra memory. This is useful for (say)
* a SLIP line discipline that wants a 32K ring buffer for data
* but doesn't need quoting.
*/
-#define QBITS
-
-#ifdef QBITS
#define QMEM(n) ((((n)-1)/NBBY)+1)
-#else
-#define QMEM(n) (n)
-#endif
void cinit __P((void));
-#ifdef QBITS
void clrbits __P((u_char *, int, int));
-#endif
/*
* Initialize clists.
@@ -134,13 +120,8 @@ getc(clp)
c = *clp->c_cf & 0xff;
if (clp->c_cq) {
-#ifdef QBITS
if (isset(clp->c_cq, clp->c_cf - clp->c_cs) )
c |= TTY_QUOTE;
-#else
- if (*(clp->c_cf - clp->c_cs + clp->c_cq))
- c |= TTY_QUOTE;
-#endif
}
if (++clp->c_cf == clp->c_ce)
clp->c_cf = clp->c_cs;
@@ -300,15 +281,10 @@ out:
*clp->c_cl = c & 0xff;
i = clp->c_cl - clp->c_cs;
if (clp->c_cq) {
-#ifdef QBITS
if (c & TTY_QUOTE)
setbit(clp->c_cq, i);
else
clrbit(clp->c_cq, i);
-#else
- q = clp->c_cq + i;
- *q = (c & TTY_QUOTE) ? 1 : 0;
-#endif
}
clp->c_cc++;
clp->c_cl++;
@@ -318,7 +294,6 @@ out:
return 0;
}
-#ifdef QBITS
/*
* optimized version of
*
@@ -358,7 +333,6 @@ clrbits(cp, off, len)
cp[i] = 0x00;
}
}
-#endif
/*
* Copy buffer to clist.
@@ -370,8 +344,8 @@ b_to_q(cp, count, clp)
int count;
struct clist *clp;
{
- register int cc;
- register u_char *p = cp;
+ int cc;
+ u_char *p = cp;
int s;
if (count <= 0)
@@ -401,11 +375,7 @@ b_to_q(cp, count, clp)
cc = count;
bcopy(p, clp->c_cl, cc);
if (clp->c_cq) {
-#ifdef QBITS
clrbits(clp->c_cq, clp->c_cl - clp->c_cs, cc);
-#else
- bzero(clp->c_cl - clp->c_cs + clp->c_cq, cc);
-#endif
}
p += cc;
count -= cc;
@@ -450,13 +420,8 @@ nextc(clp, cp, c)
cp = clp->c_cs;
*c = *cp & 0xff;
if (clp->c_cq) {
-#ifdef QBITS
if (isset(clp->c_cq, cp - clp->c_cs))
*c |= TTY_QUOTE;
-#else
- if (*(clp->c_cf - clp->c_cs + clp->c_cq))
- *c |= TTY_QUOTE;
-#endif
}
return cp;
}
@@ -484,13 +449,8 @@ firstc(clp, c)
cp = clp->c_cf;
*c = *cp & 0xff;
if (clp->c_cq) {
-#ifdef QBITS
if (isset(clp->c_cq, cp - clp->c_cs))
*c |= TTY_QUOTE;
-#else
- if (*(cp - clp->c_cs + clp->c_cq))
- *c |= TTY_QUOTE;
-#endif
}
return clp->c_cf;
}
@@ -517,13 +477,8 @@ unputc(clp)
c = *clp->c_cl & 0xff;
if (clp->c_cq) {
-#ifdef QBITS
if (isset(clp->c_cq, clp->c_cl - clp->c_cs))
c |= TTY_QUOTE;
-#else
- if (*(clp->c_cf - clp->c_cs + clp->c_cq))
- c |= TTY_QUOTE;
-#endif
}
if (clp->c_cc == 0)
clp->c_cf = clp->c_cl = (u_char *)0;