"Das U-Boot" Source Tree
at jcs/rk3128 154 lines 4.2 kB view raw
1#ifndef _LINUX_STRING_H_ 2#define _LINUX_STRING_H_ 3 4#include <linux/types.h> /* for size_t */ 5#include <linux/stddef.h> /* for NULL */ 6 7#ifdef __cplusplus 8extern "C" { 9#endif 10 11extern char * ___strtok; 12extern char * strpbrk(const char *,const char *); 13extern char * strtok(char *,const char *); 14extern char * strsep(char **,const char *); 15extern __kernel_size_t strspn(const char *,const char *); 16 17/* 18 * Include machine specific inline routines 19 */ 20#include <asm/string.h> 21 22#ifndef __HAVE_ARCH_STRCPY 23extern char * strcpy(char *,const char *); 24#endif 25#ifndef __HAVE_ARCH_STRNCPY 26extern char * strncpy(char *,const char *, __kernel_size_t); 27#endif 28#ifndef __HAVE_ARCH_STRLCPY 29size_t strlcpy(char *, const char *, size_t); 30#endif 31#ifndef __HAVE_ARCH_STRCAT 32extern char * strcat(char *, const char *); 33#endif 34#ifndef __HAVE_ARCH_STRNCAT 35extern char * strncat(char *, const char *, __kernel_size_t); 36#endif 37#ifndef __HAVE_ARCH_STRLCAT 38size_t strlcat(char *, const char *, size_t); 39#endif 40#ifndef __HAVE_ARCH_STRCMP 41extern int strcmp(const char *,const char *); 42#endif 43#ifndef __HAVE_ARCH_STRNCMP 44extern int strncmp(const char *,const char *,__kernel_size_t); 45#endif 46#ifndef __HAVE_ARCH_STRCASECMP 47int strcasecmp(const char *s1, const char *s2); 48#endif 49#ifndef __HAVE_ARCH_STRNCASECMP 50extern int strncasecmp(const char *s1, const char *s2, __kernel_size_t len); 51#endif 52#ifndef __HAVE_ARCH_STRCHR 53extern char * strchr(const char *,int); 54#endif 55 56/** 57 * strchrnul() - return position of a character in the string, or end of string 58 * 59 * The strchrnul() function is like strchr() except that if c is not found 60 * in s, then it returns a pointer to the nul byte at the end of s, rather than 61 * NULL 62 * @s: string to search 63 * @c: character to search for 64 * Return: position of @c in @s, or end of @s if not found 65 */ 66const char *strchrnul(const char *s, int c); 67 68#ifndef __HAVE_ARCH_STRRCHR 69extern char * strrchr(const char *,int); 70#endif 71#include <linux/linux_string.h> 72#ifndef __HAVE_ARCH_STRSTR 73extern char * strstr(const char *,const char *); 74#endif 75#ifndef __HAVE_ARCH_STRNSTR 76extern char *strnstr(const char *, const char *, size_t); 77#endif 78#ifndef __HAVE_ARCH_STRLEN 79extern __kernel_size_t strlen(const char *); 80#endif 81#ifndef __HAVE_ARCH_STRNLEN 82extern __kernel_size_t strnlen(const char *,__kernel_size_t); 83#endif 84 85#ifndef __HAVE_ARCH_STRCSPN 86/** 87 * strcspn() - find span of string without given characters 88 * 89 * Calculates the length of the initial segment of @s which consists entirely 90 * of bsytes not in reject. 91 * 92 * @s: string to search 93 * @reject: strings which cause the search to halt 94 * Return: number of characters at the start of @s which are not in @reject 95 */ 96size_t strcspn(const char *s, const char *reject); 97#endif 98 99#ifdef CONFIG_SANDBOX 100# define strdup sandbox_strdup 101# define strndup sandbox_strndup 102#endif 103 104#ifndef __HAVE_ARCH_STRDUP 105extern char * strdup(const char *); 106extern char * strndup(const char *, size_t); 107#endif 108#ifndef __HAVE_ARCH_STRSWAB 109extern char * strswab(const char *); 110#endif 111 112#ifndef __HAVE_ARCH_MEMSET 113extern void * memset(void *,int,__kernel_size_t); 114#endif 115#ifndef __HAVE_ARCH_MEMCPY 116extern void * memcpy(void *,const void *,__kernel_size_t); 117#endif 118#ifndef __HAVE_ARCH_MEMMOVE 119extern void * memmove(void *,const void *,__kernel_size_t); 120#endif 121#ifndef __HAVE_ARCH_MEMSCAN 122extern void * memscan(void *,int,__kernel_size_t); 123#endif 124#ifndef __HAVE_ARCH_MEMCMP 125extern int memcmp(const void *,const void *,__kernel_size_t); 126#endif 127#ifndef __HAVE_ARCH_MEMCHR 128extern void * memchr(const void *,int,__kernel_size_t); 129#endif 130#ifndef __HAVE_ARCH_MEMCHR_INV 131void *memchr_inv(const void *, int, size_t); 132#endif 133 134/** 135 * memdup() - allocate a buffer and copy in the contents 136 * 137 * Note that this returns a valid pointer even if @len is 0 138 * 139 * @src: data to copy in 140 * @len: number of bytes to copy 141 * Return: allocated buffer with the copied contents, or NULL if not enough 142 * memory is available 143 * 144 */ 145char *memdup(const void *src, size_t len); 146 147unsigned long ustrtoul(const char *cp, char **endp, unsigned int base); 148unsigned long long ustrtoull(const char *cp, char **endp, unsigned int base); 149 150#ifdef __cplusplus 151} 152#endif 153 154#endif /* _LINUX_STRING_H_ */