summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorwkoszek <wkoszek@FreeBSD.org>2007-04-10 21:42:12 +0000
committerwkoszek <wkoszek@FreeBSD.org>2007-04-10 21:42:12 +0000
commite97a378b02662f173b005847d6cd159a3a31ae58 (patch)
tree5b17f649e3d7fcfdae517ca0e0827bda313ca0d8 /sys/compat
parentf4e110ebf22bf617f42b602eae033b308e4971fb (diff)
downloadFreeBSD-src-e97a378b02662f173b005847d6cd159a3a31ae58.zip
FreeBSD-src-e97a378b02662f173b005847d6cd159a3a31ae58.tar.gz
strchr() and strrchr() are already present in the kernel, but with less
popular names. Hence: - comment current index() and rindex() functions, as these serve the same functionality as, respectively, strchr() and strrchr() from userland; - add inlined version of strchr() and strrchr(), as we tend to use them more often; - remove str[r]chr() definitions from ZFS code; Reviewed by: pjd Approved by: cognet (mentor)
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/opensolaris/kern/opensolaris_string.c31
-rw-r--r--sys/compat/opensolaris/sys/string.h4
2 files changed, 2 insertions, 33 deletions
diff --git a/sys/compat/opensolaris/kern/opensolaris_string.c b/sys/compat/opensolaris/kern/opensolaris_string.c
index cae984f..4448f34 100644
--- a/sys/compat/opensolaris/kern/opensolaris_string.c
+++ b/sys/compat/opensolaris/kern/opensolaris_string.c
@@ -32,37 +32,6 @@
(((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z'))
char *
-strchr(const char *s, int c)
-{
- char ch;
-
- ch = c;
- for (;; ++s) {
- if (*s == ch)
- return ((char *)s);
- if (*s == '\0')
- return (NULL);
- }
- /* NOTREACHED */
-}
-
-char *
-strrchr(const char *s, int c)
-{
- char *save;
- char ch;
-
- ch = c;
- for (save = NULL;; ++s) {
- if (*s == ch)
- save = (char *)s;
- if (*s == '\0')
- return (save);
- }
- /* NOTREACHED */
-}
-
-char *
strpbrk(const char *s, const char *b)
{
const char *p;
diff --git a/sys/compat/opensolaris/sys/string.h b/sys/compat/opensolaris/sys/string.h
index c802c0f..aeec929 100644
--- a/sys/compat/opensolaris/sys/string.h
+++ b/sys/compat/opensolaris/sys/string.h
@@ -29,8 +29,8 @@
#ifndef _OPENSOLARIS_SYS_STRING_H_
#define _OPENSOLARIS_SYS_STRING_H_
-char *strchr(const char *, int);
-char *strrchr(const char *p, int c);
+#include <sys/libkern.h>
+
char *strpbrk(const char *, const char *);
void strident_canon(char *s, size_t n);
OpenPOWER on IntegriCloud