diff options
author | peter <peter@FreeBSD.org> | 1999-12-10 17:38:41 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-12-10 17:38:41 +0000 |
commit | 7cd6c4d188847b8167e9a9e05ad034f5d51a13df (patch) | |
tree | 163f9248d3dedff4434849e33fd82e432ddbc804 /sys/libkern/index.c | |
parent | 108333f0a453421722555eb52a232a10bd5c4c77 (diff) | |
download | FreeBSD-src-7cd6c4d188847b8167e9a9e05ad034f5d51a13df.zip FreeBSD-src-7cd6c4d188847b8167e9a9e05ad034f5d51a13df.tar.gz |
Zap c_index() and c_rindex(). Bruce prefers these to implicitly convert
a const into a non-const as they do in libc. I feel that defeating the
type checking like that quite evil, but that's the way it is.
Diffstat (limited to 'sys/libkern/index.c')
-rw-r--r-- | sys/libkern/index.c | 28 |
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 */ |