summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty_subr.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/tty_subr.c')
-rw-r--r--sys/kern/tty_subr.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/sys/kern/tty_subr.c b/sys/kern/tty_subr.c
index 216c65528a6..e14e5bef642 100644
--- a/sys/kern/tty_subr.c
+++ b/sys/kern/tty_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty_subr.c,v 1.20 2008/03/31 22:40:34 deraadt Exp $ */
+/* $OpenBSD: tty_subr.c,v 1.21 2009/07/19 08:16:06 blambert Exp $ */
/* $NetBSD: tty_subr.c,v 1.13 1996/02/09 19:00:43 christos Exp $ */
/*
@@ -60,7 +60,7 @@ cinit(void)
* Initialize a particular clist. Ok, they are really ring buffers,
* of the specified length, with/without quoting support.
*/
-int
+void
clalloc(struct clist *clp, int size, int quot)
{
@@ -69,13 +69,12 @@ clalloc(struct clist *clp, int size, int quot)
if (quot)
clp->c_cq = malloc(QMEM(size), M_TTYS, M_WAITOK|M_ZERO);
else
- clp->c_cq = (u_char *)0;
+ clp->c_cq = NULL;
- clp->c_cf = clp->c_cl = (u_char *)0;
+ clp->c_cf = clp->c_cl = NULL;
clp->c_ce = clp->c_cs + size;
clp->c_cn = size;
clp->c_cc = 0;
- return (0);
}
void
@@ -89,7 +88,7 @@ clfree(struct clist *clp)
bzero(clp->c_cq, QMEM(clp->c_cn));
free(clp->c_cq, M_TTYS);
}
- clp->c_cs = clp->c_cq = (u_char *)0;
+ clp->c_cs = clp->c_cq = NULL;
}
@@ -245,19 +244,17 @@ putc(int c, struct clist *clp)
int s;
s = spltty();
- if (clp->c_cc == clp->c_cn)
- goto out;
+ if (clp->c_cc == clp->c_cn) {
+ splx(s);
+ return -1;
+ }
if (clp->c_cc == 0) {
if (!clp->c_cs) {
#if defined(DIAGNOSTIC) || 1
printf("putc: required clalloc\n");
#endif
- if (clalloc(clp, 1024, 1)) {
-out:
- splx(s);
- return -1;
- }
+ clalloc(clp, 1024, 1);
}
clp->c_cf = clp->c_cl = clp->c_cs;
}
@@ -338,8 +335,7 @@ b_to_q(u_char *cp, int count, struct clist *clp)
#if defined(DIAGNOSTIC) || 1
printf("b_to_q: required clalloc\n");
#endif
- if (clalloc(clp, 1024, 1))
- goto out;
+ clalloc(clp, 1024, 1);
}
clp->c_cf = clp->c_cl = clp->c_cs;
}