Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Move the add char portion to its own function.
details: https://anonhg.NetBSD.org/src/rev/4f6eb43b6ecf
branches: trunk
changeset: 321703:4f6eb43b6ecf
user: christos <christos%NetBSD.org@localhost>
date: Sun Apr 01 19:01:08 2018 +0000
description:
Move the add char portion to its own function.
diffstat:
sys/kern/subr_log.c | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
diffs (52 lines):
diff -r a72d3d9247dc -r 4f6eb43b6ecf sys/kern/subr_log.c
--- a/sys/kern/subr_log.c Sun Apr 01 18:26:51 2018 +0000
+++ b/sys/kern/subr_log.c Sun Apr 01 19:01:08 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_log.c,v 1.57 2018/03/31 23:12:01 christos Exp $ */
+/* $NetBSD: subr_log.c,v 1.58 2018/04/01 19:01:08 christos Exp $ */
/*-
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_log.c,v 1.57 2018/03/31 23:12:01 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_log.c,v 1.58 2018/04/01 19:01:08 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -404,6 +404,18 @@
}
}
+static void
+logaddchar(struct kern_msgbuf *mbp, int c)
+{
+ mbp->msg_bufc[mbp->msg_bufx++] = c;
+ if (mbp->msg_bufx < 0 || mbp->msg_bufx >= mbp->msg_bufs)
+ mbp->msg_bufx = 0;
+
+ /* If the buffer is full, keep the most recent data. */
+ if (mbp->msg_bufr == mbp->msg_bufx)
+ logskip(mbp);
+}
+
void
logputchar(int c)
{
@@ -431,13 +443,7 @@
}
- mbp->msg_bufc[mbp->msg_bufx++] = c;
- if (mbp->msg_bufx < 0 || mbp->msg_bufx >= mbp->msg_bufs)
- mbp->msg_bufx = 0;
-
- /* If the buffer is full, keep the most recent data. */
- if (mbp->msg_bufr == mbp->msg_bufx)
- logskip(mbp);
+ logaddchar(mbp, c);
out:
if (!cold)
Home |
Main Index |
Thread Index |
Old Index