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, 20 insertions, 8 deletions
diff --git a/sys/libkern/index.c b/sys/libkern/index.c
index 6351223..b22341c 100644
--- a/sys/libkern/index.c
+++ b/sys/libkern/index.c
@@ -33,21 +33,33 @@
* $FreeBSD$
*/
-#include <string.h>
+#include <sys/param.h>
+#include <sys/libkern.h>
char *
-#ifdef STRCHR
-strchr(p, ch)
-#else
index(p, ch)
-#endif
- register const char *p, ch;
+ char *p;
+ int ch;
{
for (;; ++p) {
if (*p == ch)
- return((char *)p);
+ return(p);
if (!*p)
- return((char *)NULL);
+ return(NULL);
+ }
+ /* NOTREACHED */
+}
+
+const char *
+c_index(p, ch)
+ const char *p;
+ int ch;
+{
+ for (;; ++p) {
+ if (*p == ch)
+ return(p);
+ if (!*p)
+ return(NULL);
}
/* NOTREACHED */
}
OpenPOWER on IntegriCloud