svn commit: r229366 - in head/sys: conf libkern sys
Ed Schouten
ed at FreeBSD.org
Tue Jan 3 07:05:31 UTC 2012
Author: ed
Date: Tue Jan 3 07:05:30 2012
New Revision: 229366
URL: http://svn.freebsd.org/changeset/base/229366
Log:
Implement extensions on top of standards instead of the other way around.
Now that index() and rindex() have become unused, simply turn them into
wrappers around strchr() and strrchr(), respectively.
Added:
head/sys/libkern/strchr.c
- copied, changed from r229111, head/sys/libkern/index.c
head/sys/libkern/strrchr.c
- copied, changed from r229111, head/sys/libkern/rindex.c
Deleted:
head/sys/libkern/index.c
head/sys/libkern/rindex.c
Modified:
head/sys/conf/files
head/sys/sys/libkern.h
Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files Tue Jan 3 04:12:40 2012 (r229365)
+++ head/sys/conf/files Tue Jan 3 07:05:30 2012 (r229366)
@@ -2551,7 +2551,6 @@ libkern/iconv_converter_if.m optional li
libkern/iconv_ucs.c optional libiconv
libkern/iconv_xlat.c optional libiconv
libkern/iconv_xlat16.c optional libiconv
-libkern/index.c standard
libkern/inet_aton.c standard
libkern/inet_ntoa.c standard
libkern/inet_ntop.c standard
@@ -2562,10 +2561,10 @@ libkern/memcmp.c standard
libkern/qsort.c standard
libkern/qsort_r.c standard
libkern/random.c standard
-libkern/rindex.c standard
libkern/scanc.c standard
libkern/strcasecmp.c standard
libkern/strcat.c standard
+libkern/strchr.c standard
libkern/strcmp.c standard
libkern/strcpy.c standard
libkern/strcspn.c standard
@@ -2576,6 +2575,7 @@ libkern/strlen.c standard
libkern/strncmp.c standard
libkern/strncpy.c standard
libkern/strnlen.c standard
+libkern/strrchr.c standard
libkern/strsep.c standard
libkern/strspn.c standard
libkern/strstr.c standard
Copied and modified: head/sys/libkern/strchr.c (from r229111, head/sys/libkern/index.c)
==============================================================================
--- head/sys/libkern/index.c Sat Dec 31 14:57:52 2011 (r229111, copy source)
+++ head/sys/libkern/strchr.c Tue Jan 3 07:05:30 2012 (r229366)
@@ -33,14 +33,8 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/libkern.h>
-/*
- * index() is also present as the strchr() in the kernel; it does exactly the
- * same thing as it's userland equivalent.
- */
char *
-index(p, ch)
- const char *p;
- int ch;
+strchr(const char *p, int ch)
{
union {
const char *cp;
Copied and modified: head/sys/libkern/strrchr.c (from r229111, head/sys/libkern/rindex.c)
==============================================================================
--- head/sys/libkern/rindex.c Sat Dec 31 14:57:52 2011 (r229111, copy source)
+++ head/sys/libkern/strrchr.c Tue Jan 3 07:05:30 2012 (r229366)
@@ -33,14 +33,8 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/libkern.h>
-/*
- * rindex() is also present as the strrchr() in the kernel; it does exactly the
- * same thing as it's userland equivalent.
- */
char *
-rindex(p, ch)
- const char *p;
- int ch;
+strrchr(const char *p, int ch)
{
union {
const char *cp;
Modified: head/sys/sys/libkern.h
==============================================================================
--- head/sys/sys/libkern.h Tue Jan 3 04:12:40 2012 (r229365)
+++ head/sys/sys/libkern.h Tue Jan 3 07:05:30 2012 (r229366)
@@ -99,12 +99,11 @@ void qsort(void *base, size_t nmemb, si
void qsort_r(void *base, size_t nmemb, size_t size, void *thunk,
int (*compar)(void *, const void *, const void *));
u_long random(void);
-char *index(const char *, int);
-char *rindex(const char *, int);
int scanc(u_int, const u_char *, const u_char *, int);
void srandom(u_long);
int strcasecmp(const char *, const char *);
char *strcat(char * __restrict, const char * __restrict);
+char *strchr(const char *, int);
int strcmp(const char *, const char *);
char *strcpy(char * __restrict, const char * __restrict);
size_t strcspn(const char * __restrict, const char * __restrict) __pure;
@@ -116,6 +115,7 @@ int strncasecmp(const char *, const cha
int strncmp(const char *, const char *, size_t);
char *strncpy(char * __restrict, const char * __restrict, size_t);
size_t strnlen(const char *, size_t);
+char *strrchr(const char *, int);
char *strsep(char **, const char *delim);
size_t strspn(const char *, const char *);
char *strstr(const char *, const char *);
@@ -164,15 +164,17 @@ memset(void *b, int c, size_t len)
#endif
static __inline char *
-strchr(const char *p, int ch)
+index(const char *p, int ch)
{
- return (index(p, ch));
+
+ return (strchr(p, ch));
}
static __inline char *
-strrchr(const char *p, int ch)
+rindex(const char *p, int ch)
{
- return (rindex(p, ch));
+
+ return (strrchr(p, ch));
}
/* fnmatch() return values. */
More information about the svn-src-head
mailing list