[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] xen/string: Clean up {xen, arm}/string.h
commit b02728b3b689e145a52c46cd9eae5be48e905df7 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Fri May 12 17:15:36 2017 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Wed May 31 14:05:18 2017 +0100 xen/string: Clean up {xen,arm}/string.h * Drop __kernel_size_t entirely. It isn't a useful distinction, especially as it means the the prototypes don't appear to match their common definitions. * Introduce __HAVE_ARCH_* guards for strpbrk(), strsep() and strspn(), which match their implementation in common/string.c * Apply consistent Xen style throughout. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Julien Grall <julien.grall@xxxxxxx> --- xen/include/asm-arm/string.h | 27 +++++++------ xen/include/xen/string.h | 91 +++++++++++++++++++++++++++----------------- 2 files changed, 69 insertions(+), 49 deletions(-) diff --git a/xen/include/asm-arm/string.h b/xen/include/asm-arm/string.h index 005959f..1804c3c 100644 --- a/xen/include/asm-arm/string.h +++ b/xen/include/asm-arm/string.h @@ -8,48 +8,47 @@ */ #define __HAVE_ARCH_STRRCHR -extern char * strrchr(const char * s, int c); +char *strrchr(const char *s, int c); #define __HAVE_ARCH_STRCHR -extern char * strchr(const char * s, int c); +char *strchr(const char *s, int c); #if defined(CONFIG_ARM_64) #define __HAVE_ARCH_STRCMP -extern int strcmp(const char *, const char *); +int strcmp(const char *, const char *); #define __HAVE_ARCH_STRNCMP -extern int strncmp(const char *, const char *, __kernel_size_t); +int strncmp(const char *, const char *, size_t); #define __HAVE_ARCH_STRLEN -extern __kernel_size_t strlen(const char *); +size_t strlen(const char *); #define __HAVE_ARCH_STRNLEN -extern __kernel_size_t strnlen(const char *, __kernel_size_t); +size_t strnlen(const char *, size_t); #endif #define __HAVE_ARCH_MEMCPY -extern void * memcpy(void *, const void *, __kernel_size_t); +void *memcpy(void *, const void *, size_t); #if defined(CONFIG_ARM_64) #define __HAVE_ARCH_MEMCMP -extern int memcmp(const void *, const void *, __kernel_size_t); +int memcmp(const void *, const void *, size_t); #endif -/* Some versions of gcc don't have this builtin. It's non-critical anyway. */ #define __HAVE_ARCH_MEMMOVE -extern void *memmove(void *dest, const void *src, size_t n); +void *memmove(void *dest, const void *src, size_t n); #define __HAVE_ARCH_MEMSET -extern void * memset(void *, int, __kernel_size_t); +void *memset(void *, int, size_t); #define __HAVE_ARCH_MEMCHR -extern void * memchr(const void *, int, __kernel_size_t); +void *memchr(const void *, int, size_t); #if defined(CONFIG_ARM_32) -extern void __memzero(void *ptr, __kernel_size_t n); +void __memzero(void *ptr, size_t n); -#define memset(p,v,n) \ +#define memset(p, v, n) \ ({ \ void *__p = (p); size_t __n = n; \ if ((__n) != 0) { \ diff --git a/xen/include/xen/string.h b/xen/include/xen/string.h index f35934e..eb7aeaa 100644 --- a/xen/include/xen/string.h +++ b/xen/include/xen/string.h @@ -1,19 +1,8 @@ -#ifndef _LINUX_STRING_H_ -#define _LINUX_STRING_H_ +#ifndef __XEN_STRING_H__ +#define __XEN_STRING_H__ #include <xen/types.h> /* for size_t */ -#ifdef __cplusplus -extern "C" { -#endif - -#define __kernel_size_t size_t - -extern char * strpbrk(const char *,const char *); -extern char * strsep(char **,const char *); -extern __kernel_size_t strspn(const char *,const char *); - - /* * Include machine specific inline routines */ @@ -29,60 +18,84 @@ extern __kernel_size_t strspn(const char *,const char *); #define strncat __xen_has_no_strncat__ #ifndef __HAVE_ARCH_STRLCPY -extern size_t strlcpy(char *,const char *, __kernel_size_t); +size_t strlcpy(char *, const char *, size_t); #endif + #ifndef __HAVE_ARCH_STRLCAT -extern size_t strlcat(char *,const char *, __kernel_size_t); +size_t strlcat(char *, const char *, size_t); #endif + #ifndef __HAVE_ARCH_STRCMP -extern int strcmp(const char *,const char *); +int strcmp(const char *, const char *); #endif + #ifndef __HAVE_ARCH_STRNCMP -extern int strncmp(const char *,const char *,__kernel_size_t); +int strncmp(const char *, const char *, size_t); #endif + #ifndef __HAVE_ARCH_STRNICMP -extern int strnicmp(const char *, const char *, __kernel_size_t); +int strnicmp(const char *, const char *, size_t); #endif + #ifndef __HAVE_ARCH_STRCASECMP -extern int strcasecmp(const char *, const char *); +int strcasecmp(const char *, const char *); #endif + #ifndef __HAVE_ARCH_STRCHR -extern char * strchr(const char *,int); +char *strchr(const char *, int); #endif + #ifndef __HAVE_ARCH_STRRCHR -extern char * strrchr(const char *,int); +char *strrchr(const char *, int); #endif + #ifndef __HAVE_ARCH_STRSTR -extern char * strstr(const char *,const char *); +char *strstr(const char *, const char *); #endif + #ifndef __HAVE_ARCH_STRLEN -extern __kernel_size_t strlen(const char *); +size_t strlen(const char *); #endif + #ifndef __HAVE_ARCH_STRNLEN -extern __kernel_size_t strnlen(const char *,__kernel_size_t); +size_t strnlen(const char *, size_t); #endif +#ifndef __HAVE_ARCH_STRPBRK +char *strpbrk(const char *, const char *); +#endif + +#ifndef __HAVE_ARCH_STRSEP +char *strsep(char **, const char *); +#endif + +#ifndef __HAVE_ARCH_STRSPN +size_t strspn(const char *, const char *); +#endif + + #ifndef __HAVE_ARCH_MEMSET -extern void * memset(void *,int,__kernel_size_t); +void *memset(void *, int, size_t); #endif + #ifndef __HAVE_ARCH_MEMCPY -extern void * memcpy(void *,const void *,__kernel_size_t); +void *memcpy(void *, const void *, size_t); #endif + #ifndef __HAVE_ARCH_MEMMOVE -extern void * memmove(void *,const void *,__kernel_size_t); +void *memmove(void *, const void *, size_t); #endif + #ifndef __HAVE_ARCH_MEMSCAN -extern void * memscan(void *,int,__kernel_size_t); +void *memscan(void *, int, size_t); #endif + #ifndef __HAVE_ARCH_MEMCMP -extern int memcmp(const void *,const void *,__kernel_size_t); -#endif -#ifndef __HAVE_ARCH_MEMCHR -extern void * memchr(const void *,int,__kernel_size_t); +int memcmp(const void *, const void *, size_t); #endif -#ifdef __cplusplus -} +#ifndef __HAVE_ARCH_MEMCHR +void *memchr(const void *, int, size_t); #endif #define is_char_array(x) __builtin_types_compatible_p(typeof(x), char[]) @@ -97,4 +110,12 @@ extern void * memchr(const void *,int,__kernel_size_t); (strlcat(d, s, sizeof(d)) >= sizeof(d)); \ }) -#endif /* _LINUX_STRING_H_ */ +#endif /* __XEN_STRING_H__ */ +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |