mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 17:33:08 +08:00
add #undef for some libc function
since it's useful to redirect these functions to others sometime(e.g. validate the memory before write). Change-Id: I6253a9231af8809e8362f4bc5a1bd67fb094c3b0
This commit is contained in:
committed by
Gustavo Henrique Nihei
parent
82c17fd6fa
commit
def007e2d7
@@ -32,6 +32,7 @@
|
||||
* Name: index
|
||||
****************************************************************************/
|
||||
|
||||
#undef index /* See mm/README.txt */
|
||||
FAR char *index(FAR const char *s, int c)
|
||||
{
|
||||
return strchr(s, c);
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#undef memccpy /* See mm/README.txt */
|
||||
FAR void *memccpy(FAR void *s1, FAR const void *s2, int c, size_t n)
|
||||
{
|
||||
FAR unsigned char *pout = (FAR unsigned char *)s1;
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#undef memchr /* See mm/README.txt */
|
||||
FAR void *memchr(FAR const void *s, int c, size_t n)
|
||||
{
|
||||
FAR const unsigned char *p = (FAR const unsigned char *)s;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_LIBC_ARCH_MEMCMP
|
||||
#undef memcmp /* See mm/README.txt */
|
||||
int memcmp(FAR const void *s1, FAR const void *s2, size_t n)
|
||||
{
|
||||
unsigned char *p1 = (unsigned char *)s1;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_LIBC_ARCH_MEMCPY
|
||||
#undef memcpy /* See mm/README.txt */
|
||||
FAR void *memcpy(FAR void *dest, FAR const void *src, size_t n)
|
||||
{
|
||||
FAR unsigned char *pout = (FAR unsigned char *)dest;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_LIBC_ARCH_MEMMOVE
|
||||
#undef memmove /* See mm/README.txt */
|
||||
FAR void *memmove(FAR void *dest, FAR const void *src, size_t count)
|
||||
{
|
||||
FAR char *tmp;
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_LIBC_ARCH_MEMSET
|
||||
#undef memset /* See mm/README.txt */
|
||||
FAR void *memset(FAR void *s, int c, size_t n)
|
||||
{
|
||||
#ifdef CONFIG_MEMSET_OPTSPEED
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
* Name: rindex
|
||||
****************************************************************************/
|
||||
|
||||
#undef rindex /* See mm/README.txt */
|
||||
FAR char *rindex(FAR const char *s, int c)
|
||||
{
|
||||
return strrchr(s, c);
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_ARCH_STRCASECMP
|
||||
#undef strcasecmp /* See mm/README.txt */
|
||||
int strcasecmp(FAR const char *cs, FAR const char *ct)
|
||||
{
|
||||
int result;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_ARCH_STRCAT
|
||||
#undef strcat /* See mm/README.txt */
|
||||
char *strcat(char *dest, const char *src)
|
||||
{
|
||||
char *ret = dest;
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_LIBC_ARCH_STRCHR
|
||||
#undef strchr /* See mm/README.txt */
|
||||
FAR char *strchr(FAR const char *s, int c)
|
||||
{
|
||||
if (s)
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_LIBC_ARCH_STRCMP
|
||||
#undef strcmp /* See mm/README.txt */
|
||||
int strcmp(FAR const char *cs, FAR const char *ct)
|
||||
{
|
||||
register signed char result;
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_LIBC_ARCH_STRCPY
|
||||
#undef strcpy /* See mm/README.txt */
|
||||
FAR char *strcpy(FAR char *dest, FAR const char *src)
|
||||
{
|
||||
char *tmp = dest;
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#undef strcspn /* See mm/README.txt */
|
||||
size_t strcspn(const char *s, const char *reject)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#undef strdup /* See mm/README.txt */
|
||||
FAR char *strdup(FAR const char *s)
|
||||
{
|
||||
FAR char *news = NULL;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_LIBC_ARCH_STRLEN
|
||||
#undef strlen /* See mm/README.txt */
|
||||
size_t strlen(const char *s)
|
||||
{
|
||||
const char *sc;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_ARCH_STRNCASECMP
|
||||
#undef strncasecmp /* See mm/README.txt */
|
||||
int strncasecmp(const char *cs, const char *ct, size_t nb)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_ARCH_STRNCAT
|
||||
#undef strncat /* See mm/README.txt */
|
||||
char *strncat(char *dest, const char *src, size_t n)
|
||||
{
|
||||
char *ret = dest;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_ARCH_STRNCMP
|
||||
#undef strncmp /* See mm/README.txt */
|
||||
int strncmp(const char *cs, const char *ct, size_t nb)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_LIBC_ARCH_STRNCPY
|
||||
#undef strncpy /* See mm/README.txt */
|
||||
FAR char *strncpy(FAR char *dest, FAR const char *src, size_t n)
|
||||
{
|
||||
FAR char *ret = dest; /* Value to be returned */
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#undef strndup /* See mm/README.txt */
|
||||
FAR char *strndup(FAR const char *s, size_t size)
|
||||
{
|
||||
FAR char *news = NULL;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#undef strpbrk /* See mm/README.txt */
|
||||
FAR char *strpbrk(FAR const char *str, FAR const char *charset)
|
||||
{
|
||||
/* Sanity checking */
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
* occurrence of the character c in the string s.
|
||||
*/
|
||||
|
||||
#undef strrchr /* See mm/README.txt */
|
||||
FAR char *strrchr(FAR const char *s, int c)
|
||||
{
|
||||
if (s)
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#undef strspn /* See mm/README.txt */
|
||||
size_t strspn(const char *s, const char *accept)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#undef strstr /* See mm/README.txt */
|
||||
FAR char *strstr(FAR const char *str, FAR const char *substr)
|
||||
{
|
||||
FAR const char *candidate; /* Candidate in str with matching start character */
|
||||
|
||||
@@ -66,6 +66,7 @@ static char *g_saveptr = NULL;
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#undef strtok /* See mm/README.txt */
|
||||
char *strtok(char *str, const char *delim)
|
||||
{
|
||||
return strtok_r(str, delim, &g_saveptr);
|
||||
|
||||
Reference in New Issue
Block a user