summaryrefslogtreecommitdiffstats
path: root/sys/libkern/index.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/libkern/index.c')
-rw-r--r--sys/libkern/index.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/sys/libkern/index.c b/sys/libkern/index.c
index b22341c..5c592bf 100644
--- a/sys/libkern/index.c
+++ b/sys/libkern/index.c
@@ -38,27 +38,19 @@
char *
index(p, ch)
- char *p;
- int ch;
-{
- for (;; ++p) {
- if (*p == ch)
- return(p);
- if (!*p)
- return(NULL);
- }
- /* NOTREACHED */
-}
-
-const char *
-c_index(p, ch)
const char *p;
int ch;
{
- for (;; ++p) {
- if (*p == ch)
- return(p);
- if (!*p)
+ union {
+ const char *cp;
+ char *p;
+ } u;
+
+ u.cp = p;
+ for (;; ++u.p) {
+ if (*u.p == ch)
+ return(u.p);
+ if (!*u.p)
return(NULL);
}
/* NOTREACHED */
OpenPOWER on IntegriCloud