Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch g/c local index() routine and switch to (libkern's)...
details: https://anonhg.NetBSD.org/src/rev/b98330d0a63e
branches: trunk
changeset: 554733:b98330d0a63e
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Sat Nov 01 12:56:32 2003 +0000
description:
g/c local index() routine and switch to (libkern's) strchr()
diffstat:
sys/arch/amiga/dev/ite.c | 22 ++++++----------------
sys/arch/atari/dev/ite.c | 27 ++++++++-------------------
sys/arch/x68k/dev/ite.c | 27 ++++++++-------------------
3 files changed, 22 insertions(+), 54 deletions(-)
diffs (244 lines):
diff -r c6a46e2a8d0f -r b98330d0a63e sys/arch/amiga/dev/ite.c
--- a/sys/arch/amiga/dev/ite.c Sat Nov 01 12:53:33 2003 +0000
+++ b/sys/arch/amiga/dev/ite.c Sat Nov 01 12:56:32 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ite.c,v 1.65 2003/08/07 16:26:41 agc Exp $ */
+/* $NetBSD: ite.c,v 1.66 2003/11/01 12:56:32 jdolecek Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
@@ -83,7 +83,7 @@
#include "opt_ddb.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.65 2003/08/07 16:26:41 agc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.66 2003/11/01 12:56:32 jdolecek Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -154,7 +154,6 @@
-39,-75,-103,-121,-127,-121,-103,-75,-39
};
-static char *index(const char *, char);
void iteputchar(int c, struct ite_softc *ip);
void ite_putstr(const char * s, int len, dev_t dev);
void iteattach(struct device *, struct device *, void *);
@@ -1021,7 +1020,7 @@
0x5c /* / */, 0x5d /* * */
};
static char *out = "pqrstuvwxymlnMPQRS";
- char *cp = index (in, c);
+ char *cp = strchr(in, c);
/*
* keypad-appmode sends SS3 followed by the above
@@ -1049,7 +1048,7 @@
*/
if (c >= 0x4c && c <= 0x4f && kbd_ite->cursor_appmode
&& !bcmp(str, "\x03\x1b[", 3) &&
- index("ABCD", str[3]))
+ strchr("ABCD", str[3]))
str = app_cursor + 4 * (str[3] - 'A');
/*
@@ -1298,15 +1297,6 @@
return n;
}
-static char *
-index(const char *cp, char ch)
-{
- while (*cp && *cp != ch) cp++;
- return *cp ? (char *) cp : 0;
-}
-
-
-
inline static int
ite_argnum(struct ite_softc *ip)
{
@@ -1817,7 +1807,7 @@
*ip->ap = 0;
y = atoi(ip->argbuf);
x = 0;
- cp = index(ip->argbuf, ';');
+ cp = strchr(ip->argbuf, ';');
if (cp)
x = atoi(cp + 1);
if (x)
@@ -1927,7 +1917,7 @@
x = atoi(ip->argbuf);
x = x ? x : 1;
y = ip->rows;
- cp = index(ip->argbuf, ';');
+ cp = strchr(ip->argbuf, ';');
if (cp) {
y = atoi(cp + 1);
y = y ? y : ip->rows;
diff -r c6a46e2a8d0f -r b98330d0a63e sys/arch/atari/dev/ite.c
--- a/sys/arch/atari/dev/ite.c Sat Nov 01 12:53:33 2003 +0000
+++ b/sys/arch/atari/dev/ite.c Sat Nov 01 12:56:32 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ite.c,v 1.41 2003/08/07 16:27:00 agc Exp $ */
+/* $NetBSD: ite.c,v 1.42 2003/11/01 12:56:32 jdolecek Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
@@ -81,7 +81,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.41 2003/08/07 16:27:00 agc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.42 2003/11/01 12:56:32 jdolecek Exp $");
#include "opt_ddb.h"
@@ -164,7 +164,6 @@
static __inline__ void snap_cury __P((struct ite_softc *));
static void alignment_display __P((struct ite_softc *));
-static char *index __P((const char *, int));
static struct ite_softc *getitesp __P((dev_t));
static void itecheckwrap __P((struct ite_softc *));
static void iteprecheckwrap __P((struct ite_softc *));
@@ -1112,9 +1111,9 @@
}
else if((key.mode & KBD_MODE_KPAD)
&& (kbd_ite && kbd_ite->keypad_appmode)) {
- static char *in = "0123456789-+.\r()/*";
- static char *out = "pqrstuvwxymlnMPQRS";
- char *cp = index(in, code);
+ static const char * const in = "0123456789-+.\r()/*";
+ static const char * const out = "pqrstuvwxymlnMPQRS";
+ char *cp = strchr(in, code);
/*
* keypad-appmode sends SS3 followed by the above
@@ -1143,7 +1142,7 @@
if(((c == 0x48) || (c == 0x4b) || (c == 0x4d) || (c == 0x50))
&& kbd_ite->cursor_appmode
&& !bcmp(str, "\x03\x1b[", 3) &&
- index("ABCD", str[3]))
+ strchr("ABCD", str[3]))
str = app_cursor + 4 * (str[3] - 'A');
/*
@@ -1414,16 +1413,6 @@
return n;
}
-static char *
-index (cp, ch)
- const char *cp;
- int ch;
-{
- while (*cp && *cp != ch) cp++;
- return *cp ? (char *) cp : 0;
-}
-
-
static __inline__ int
ite_argnum (ip)
struct ite_softc *ip;
@@ -1937,7 +1926,7 @@
*ip->ap = 0;
y = atoi (ip->argbuf);
x = 0;
- cp = index (ip->argbuf, ';');
+ cp = strchr(ip->argbuf, ';');
if (cp)
x = atoi (cp + 1);
if (x) x--;
@@ -2054,7 +2043,7 @@
x = atoi (ip->argbuf);
x = x ? x : 1;
y = ip->rows;
- cp = index (ip->argbuf, ';');
+ cp = strchr(ip->argbuf, ';');
if (cp)
{
y = atoi (cp + 1);
diff -r c6a46e2a8d0f -r b98330d0a63e sys/arch/x68k/dev/ite.c
--- a/sys/arch/x68k/dev/ite.c Sat Nov 01 12:53:33 2003 +0000
+++ b/sys/arch/x68k/dev/ite.c Sat Nov 01 12:56:32 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ite.c,v 1.35 2003/08/07 16:30:24 agc Exp $ */
+/* $NetBSD: ite.c,v 1.36 2003/11/01 12:56:32 jdolecek Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
@@ -83,7 +83,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.35 2003/08/07 16:30:24 agc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.36 2003/11/01 12:56:32 jdolecek Exp $");
#include "ite.h"
#if NITE > 0
@@ -151,7 +151,6 @@
static int ite_zargnum __P((struct ite_softc *ip));
static void ite_sendstr __P((struct ite_softc *ip, char *str));
__inline static int atoi __P((const char *cp));
-__inline static char *index __P((const char *cp, char ch));
void ite_reset __P((struct ite_softc *ip));
struct ite_softc *getitesp __P((dev_t));
int iteon __P((dev_t, int));
@@ -948,9 +947,9 @@
code |= 0x80;
} else if ((key.mode & KBD_MODE_KPAD) &&
(kbd_ite && kbd_ite->keypad_appmode)) {
- static char *in = "0123456789-+.\r()/*";
- static char *out = "pqrstuvwxymlnMPQRS";
- char *cp = index (in, code);
+ static const char * const in = "0123456789-+.\r()/*";
+ static const char * const out = "pqrstuvwxymlnMPQRS";
+ char *cp = strchr(in, code);
/*
* keypad-appmode sends SS3 followed by the above
@@ -978,7 +977,7 @@
*/
if (c >= 0x3b && c <= 0x3e && kbd_ite->cursor_appmode
&& !memcmp(str, "\x03\x1b[", 3) &&
- index("ABCD", str[3]))
+ strchr("ABCD", str[3]))
str = app_cursor + 4 * (str[3] - 'A');
/*
@@ -1251,16 +1250,6 @@
return n;
}
-__inline static char *
-index(cp, ch)
- const char *cp;
- char ch;
-{
- while (*cp && *cp != ch)
- cp++;
- return *cp ? (char *) cp : 0;
-}
-
__inline static int
ite_argnum (ip)
struct ite_softc *ip;
@@ -1836,7 +1825,7 @@
*ip->ap = 0;
y = atoi (ip->argbuf);
x = 0;
- cp = index (ip->argbuf, ';');
+ cp = strchr(ip->argbuf, ';');
if (cp)
x = atoi (cp + 1);
if (x) x--;
@@ -1983,7 +1972,7 @@
x = atoi (ip->argbuf);
x = x ? x : 1;
y = ip->rows;
- cp = index (ip->argbuf, ';');
+ cp = strchr(ip->argbuf, ';');
if (cp) {
y = atoi (cp + 1);
y = y ? y : ip->rows;
Home |
Main Index |
Thread Index |
Old Index