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.
This commit is contained in:
parent
04f883d798
commit
22fec34a57
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=229366
@ -2551,7 +2551,6 @@ libkern/iconv_converter_if.m optional libiconv
|
|||||||
libkern/iconv_ucs.c optional libiconv
|
libkern/iconv_ucs.c optional libiconv
|
||||||
libkern/iconv_xlat.c optional libiconv
|
libkern/iconv_xlat.c optional libiconv
|
||||||
libkern/iconv_xlat16.c optional libiconv
|
libkern/iconv_xlat16.c optional libiconv
|
||||||
libkern/index.c standard
|
|
||||||
libkern/inet_aton.c standard
|
libkern/inet_aton.c standard
|
||||||
libkern/inet_ntoa.c standard
|
libkern/inet_ntoa.c standard
|
||||||
libkern/inet_ntop.c standard
|
libkern/inet_ntop.c standard
|
||||||
@ -2562,10 +2561,10 @@ libkern/memcmp.c standard
|
|||||||
libkern/qsort.c standard
|
libkern/qsort.c standard
|
||||||
libkern/qsort_r.c standard
|
libkern/qsort_r.c standard
|
||||||
libkern/random.c standard
|
libkern/random.c standard
|
||||||
libkern/rindex.c standard
|
|
||||||
libkern/scanc.c standard
|
libkern/scanc.c standard
|
||||||
libkern/strcasecmp.c standard
|
libkern/strcasecmp.c standard
|
||||||
libkern/strcat.c standard
|
libkern/strcat.c standard
|
||||||
|
libkern/strchr.c standard
|
||||||
libkern/strcmp.c standard
|
libkern/strcmp.c standard
|
||||||
libkern/strcpy.c standard
|
libkern/strcpy.c standard
|
||||||
libkern/strcspn.c standard
|
libkern/strcspn.c standard
|
||||||
@ -2576,6 +2575,7 @@ libkern/strlen.c standard
|
|||||||
libkern/strncmp.c standard
|
libkern/strncmp.c standard
|
||||||
libkern/strncpy.c standard
|
libkern/strncpy.c standard
|
||||||
libkern/strnlen.c standard
|
libkern/strnlen.c standard
|
||||||
|
libkern/strrchr.c standard
|
||||||
libkern/strsep.c standard
|
libkern/strsep.c standard
|
||||||
libkern/strspn.c standard
|
libkern/strspn.c standard
|
||||||
libkern/strstr.c standard
|
libkern/strstr.c standard
|
||||||
|
@ -33,14 +33,8 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/libkern.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 *
|
char *
|
||||||
index(p, ch)
|
strchr(const char *p, int ch)
|
||||||
const char *p;
|
|
||||||
int ch;
|
|
||||||
{
|
{
|
||||||
union {
|
union {
|
||||||
const char *cp;
|
const char *cp;
|
@ -33,14 +33,8 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/libkern.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 *
|
char *
|
||||||
rindex(p, ch)
|
strrchr(const char *p, int ch)
|
||||||
const char *p;
|
|
||||||
int ch;
|
|
||||||
{
|
{
|
||||||
union {
|
union {
|
||||||
const char *cp;
|
const char *cp;
|
@ -99,12 +99,11 @@ void qsort(void *base, size_t nmemb, size_t size,
|
|||||||
void qsort_r(void *base, size_t nmemb, size_t size, void *thunk,
|
void qsort_r(void *base, size_t nmemb, size_t size, void *thunk,
|
||||||
int (*compar)(void *, const void *, const void *));
|
int (*compar)(void *, const void *, const void *));
|
||||||
u_long random(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);
|
int scanc(u_int, const u_char *, const u_char *, int);
|
||||||
void srandom(u_long);
|
void srandom(u_long);
|
||||||
int strcasecmp(const char *, const char *);
|
int strcasecmp(const char *, const char *);
|
||||||
char *strcat(char * __restrict, const char * __restrict);
|
char *strcat(char * __restrict, const char * __restrict);
|
||||||
|
char *strchr(const char *, int);
|
||||||
int strcmp(const char *, const char *);
|
int strcmp(const char *, const char *);
|
||||||
char *strcpy(char * __restrict, const char * __restrict);
|
char *strcpy(char * __restrict, const char * __restrict);
|
||||||
size_t strcspn(const char * __restrict, const char * __restrict) __pure;
|
size_t strcspn(const char * __restrict, const char * __restrict) __pure;
|
||||||
@ -116,6 +115,7 @@ int strncasecmp(const char *, const char *, size_t);
|
|||||||
int strncmp(const char *, const char *, size_t);
|
int strncmp(const char *, const char *, size_t);
|
||||||
char *strncpy(char * __restrict, const char * __restrict, size_t);
|
char *strncpy(char * __restrict, const char * __restrict, size_t);
|
||||||
size_t strnlen(const char *, size_t);
|
size_t strnlen(const char *, size_t);
|
||||||
|
char *strrchr(const char *, int);
|
||||||
char *strsep(char **, const char *delim);
|
char *strsep(char **, const char *delim);
|
||||||
size_t strspn(const char *, const char *);
|
size_t strspn(const char *, const char *);
|
||||||
char *strstr(const char *, const char *);
|
char *strstr(const char *, const char *);
|
||||||
@ -164,15 +164,17 @@ memset(void *b, int c, size_t len)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static __inline char *
|
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 *
|
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. */
|
/* fnmatch() return values. */
|
||||||
|
Loading…
Reference in New Issue
Block a user