📄 string2.h
字号:
(__const char *) (s1))[1] - __s2[1]); \ if (l1 > 1 && __result == 0) \ { \ __result = (((__const unsigned char *) \ (__const char *) (s1))[2] - __s2[2]);\ if (l1 > 2 && __result == 0) \ __result = (((__const unsigned char *) \ (__const char *) (s1))[3] \ - __s2[3]); \ } \ } \ __result; }))# define __strcmp_gc(s1, s2, l2) \ (__extension__ ({ __const unsigned char *__s1 = \ (__const unsigned char *) (__const char *) (s1); \ register int __result = \ __s1[0] - ((__const unsigned char *) \ (__const char *) (s2))[0]; \ if (l2 > 0 && __result == 0) \ { \ __result = (__s1[1] \ - ((__const unsigned char *) \ (__const char *) (s2))[1]); \ if (l2 > 1 && __result == 0) \ { \ __result = \ (__s1[2] - ((__const unsigned char *) \ (__const char *) (s2))[2]); \ if (l2 > 2 && __result == 0) \ __result = \ (__s1[3] \ - ((__const unsigned char *) \ (__const char *) (s2))[3]); \ } \ } \ __result; }))#endif/* Compare N characters of S1 and S2. */#ifndef _HAVE_STRING_ARCH_strncmp# define strncmp(s1, s2, n) \ (__extension__ (__builtin_constant_p (n) \ && ((__builtin_constant_p (s1) \ && strlen (s1) < ((size_t) (n))) \ || (__builtin_constant_p (s2) \ && strlen (s2) < ((size_t) (n)))) \ ? strcmp (s1, s2) : strncmp (s1, s2, n)))#endif/* Return the length of the initial segment of S which consists entirely of characters not in REJECT. */#if !defined _HAVE_STRING_ARCH_strcspn || defined _FORCE_INLINES# ifndef _HAVE_STRING_ARCH_strcspn# define strcspn(s, reject) \ __extension__ \ ({ char __r0, __r1, __r2; \ (__builtin_constant_p (reject) && __string2_1bptr_p (reject) \ ? ((__r0 = ((__const char *) (reject))[0], __r0 == '\0') \ ? strlen (s) \ : ((__r1 = ((__const char *) (reject))[1], __r1 == '\0') \ ? __strcspn_c1 (s, __r0) \ : ((__r2 = ((__const char *) (reject))[2], __r2 == '\0') \ ? __strcspn_c2 (s, __r0, __r1) \ : (((__const char *) (reject))[3] == '\0' \ ? __strcspn_c3 (s, __r0, __r1, __r2) \ : strcspn (s, reject))))) \ : strcspn (s, reject)); })# endif__STRING_INLINE size_t __strcspn_c1 (__const char *__s, int __reject);__STRING_INLINE size_t__strcspn_c1 (__const char *__s, int __reject){ register size_t __result = 0; while (__s[__result] != '\0' && __s[__result] != __reject) ++__result; return __result;}__STRING_INLINE size_t __strcspn_c2 (__const char *__s, int __reject1, int __reject2);__STRING_INLINE size_t__strcspn_c2 (__const char *__s, int __reject1, int __reject2){ register size_t __result = 0; while (__s[__result] != '\0' && __s[__result] != __reject1 && __s[__result] != __reject2) ++__result; return __result;}__STRING_INLINE size_t __strcspn_c3 (__const char *__s, int __reject1, int __reject2, int __reject3);__STRING_INLINE size_t__strcspn_c3 (__const char *__s, int __reject1, int __reject2, int __reject3){ register size_t __result = 0; while (__s[__result] != '\0' && __s[__result] != __reject1 && __s[__result] != __reject2 && __s[__result] != __reject3) ++__result; return __result;}#endif/* Return the length of the initial segment of S which consists entirely of characters in ACCEPT. */#if !defined _HAVE_STRING_ARCH_strspn || defined _FORCE_INLINES# ifndef _HAVE_STRING_ARCH_strspn# define strspn(s, accept) \ __extension__ \ ({ char __a0, __a1, __a2; \ (__builtin_constant_p (accept) && __string2_1bptr_p (accept) \ ? ((__a0 = ((__const char *) (accept))[0], __a0 == '\0') \ ? ((void) (s), 0) \ : ((__a1 = ((__const char *) (accept))[1], __a1 == '\0') \ ? __strspn_c1 (s, __a0) \ : ((__a2 = ((__const char *) (accept))[2], __a2 == '\0') \ ? __strspn_c2 (s, __a0, __a1) \ : (((__const char *) (accept))[3] == '\0' \ ? __strspn_c3 (s, __a0, __a1, __a2) \ : strspn (s, accept))))) \ : strspn (s, accept)); })# endif__STRING_INLINE size_t __strspn_c1 (__const char *__s, int __accept);__STRING_INLINE size_t__strspn_c1 (__const char *__s, int __accept){ register size_t __result = 0; /* Please note that __accept never can be '\0'. */ while (__s[__result] == __accept) ++__result; return __result;}__STRING_INLINE size_t __strspn_c2 (__const char *__s, int __accept1, int __accept2);__STRING_INLINE size_t__strspn_c2 (__const char *__s, int __accept1, int __accept2){ register size_t __result = 0; /* Please note that __accept1 and __accept2 never can be '\0'. */ while (__s[__result] == __accept1 || __s[__result] == __accept2) ++__result; return __result;}__STRING_INLINE size_t __strspn_c3 (__const char *__s, int __accept1, int __accept2, int __accept3);__STRING_INLINE size_t__strspn_c3 (__const char *__s, int __accept1, int __accept2, int __accept3){ register size_t __result = 0; /* Please note that __accept1 to __accept3 never can be '\0'. */ while (__s[__result] == __accept1 || __s[__result] == __accept2 || __s[__result] == __accept3) ++__result; return __result;}#endif/* Find the first occurrence in S of any character in ACCEPT. */#if !defined _HAVE_STRING_ARCH_strpbrk || defined _FORCE_INLINES# ifndef _HAVE_STRING_ARCH_strpbrk# define strpbrk(s, accept) \ __extension__ \ ({ char __a0, __a1, __a2; \ (__builtin_constant_p (accept) && __string2_1bptr_p (accept) \ ? ((__a0 = ((__const char *) (accept))[0], __a0 == '\0') \ ? ((void) (s), NULL) \ : ((__a1 = ((__const char *) (accept))[1], __a1 == '\0') \ ? strchr (s, __a0) \ : ((__a2 = ((__const char *) (accept))[2], __a2 == '\0') \ ? __strpbrk_c2 (s, __a0, __a1) \ : (((__const char *) (accept))[3] == '\0' \ ? __strpbrk_c3 (s, __a0, __a1, __a2) \ : strpbrk (s, accept))))) \ : strpbrk (s, accept)); })# endif__STRING_INLINE char *__strpbrk_c2 (__const char *__s, int __accept1, int __accept2);__STRING_INLINE char *__strpbrk_c2 (__const char *__s, int __accept1, int __accept2){ /* Please note that __accept1 and __accept2 never can be '\0'. */ while (*__s != '\0' && *__s != __accept1 && *__s != __accept2) ++__s; return *__s == '\0' ? NULL : (char *) (size_t) __s;}__STRING_INLINE char *__strpbrk_c3 (__const char *__s, int __accept1, int __accept2, int __accept3);__STRING_INLINE char *__strpbrk_c3 (__const char *__s, int __accept1, int __accept2, int __accept3){ /* Please note that __accept1 to __accept3 never can be '\0'. */ while (*__s != '\0' && *__s != __accept1 && *__s != __accept2 && *__s != __accept3) ++__s; return *__s == '\0' ? NULL : (char *) (size_t) __s;}#endif/* Find the first occurrence of NEEDLE in HAYSTACK. Newer gcc versions do this itself. */#if !defined _HAVE_STRING_ARCH_strstr && !__GNUC_PREREQ (2, 97)# define strstr(haystack, needle) \ (__extension__ (__builtin_constant_p (needle) && __string2_1bptr_p (needle) \ ? (((__const char *) (needle))[0] == '\0' \ ? (char *) (size_t) (haystack) \ : (((__const char *) (needle))[1] == '\0' \ ? strchr (haystack, \ ((__const char *) (needle))[0]) \ : strstr (haystack, needle))) \ : strstr (haystack, needle)))#endif#if !defined _HAVE_STRING_ARCH_strtok_r || defined _FORCE_INLINES# ifndef _HAVE_STRING_ARCH_strtok_r# define __strtok_r(s, sep, nextp) \ (__extension__ (__builtin_constant_p (sep) && __string2_1bptr_p (sep) \ ? (((__const char *) (sep))[0] != '\0' \ && ((__const char *) (sep))[1] == '\0' \ ? __strtok_r_1c (s, ((__const char *) (sep))[0], nextp) \ : __strtok_r (s, sep, nextp)) \ : __strtok_r (s, sep, nextp)))# endif__STRING_INLINE char *__strtok_r_1c (char *__s, char __sep, char **__nextp);__STRING_INLINE char *__strtok_r_1c (char *__s, char __sep, char **__nextp){ char *__result; if (__s == NULL) __s = *__nextp; while (*__s == __sep) ++__s; __result = NULL; if (*__s != '\0') { __result = __s++; while (*__s != '\0') if (*__s++ == __sep) { __s[-1] = '\0'; break; } *__nextp = __s; } return __result;}# if defined __USE_POSIX || defined __USE_MISC# define strtok_r(s, sep, nextp) __strtok_r (s, sep, nextp)# endif#endif#if !defined _HAVE_STRING_ARCH_strsep || defined _FORCE_INLINES# ifndef _HAVE_STRING_ARCH_strsepextern char *__strsep_g (char **__stringp, __const char *__delim);# define __strsep(s, reject) \ __extension__ \ ({ char __r0, __r1, __r2; \ (__builtin_constant_p (reject) && __string2_1bptr_p (reject) \ && (__r0 = ((__const char *) (reject))[0], \ ((__const char *) (reject))[0] != '\0') \ ? ((__r1 = ((__const char *) (reject))[1], \ ((__const char *) (reject))[1] == '\0') \ ? __strsep_1c (s, __r0) \ : ((__r2 = ((__const char *) (reject))[2], __r2 == '\0') \ ? __strsep_2c (s, __r0, __r1) \ : (((__const char *) (reject))[3] == '\0' \ ? __strsep_3c (s, __r0, __r1, __r2) \ : __strsep_g (s, reject)))) \ : __strsep_g (s, reject)); })# endif__STRING_INLINE char *__strsep_1c (char **__s, char __reject);__STRING_INLINE char *__strsep_1c (char **__s, char __reject){ register char *__retval = *__s; if (__retval != NULL && (*__s = strchr (__retval, __reject)) != NULL) *(*__s)++ = '\0'; return __retval;}__STRING_INLINE char *__strsep_2c (char **__s, char __reject1, char __reject2);__STRING_INLINE char *__strsep_2c (char **__s, char __reject1, char __reject2){ register char *__retval = *__s; if (__retval != NULL) { register char *__cp = __retval; while (1) { if (*__cp == '\0') { __cp = NULL; break; } if (*__cp == __reject1 || *__cp == __reject2) { *__cp++ = '\0'; break; } ++__cp; } *__s = __cp; } return __retval;}__STRING_INLINE char *__strsep_3c (char **__s, char __reject1, char __reject2, char __reject3);__STRING_INLINE char *__strsep_3c (char **__s, char __reject1, char __reject2, char __reject3){ register char *__retval = *__s; if (__retval != NULL) { register char *__cp = __retval; while (1) { if (*__cp == '\0') { __cp = NULL; break; } if (*__cp == __reject1 || *__cp == __reject2 || *__cp == __reject3) { *__cp++ = '\0'; break; } ++__cp; } *__s = __cp; } return __retval;}# ifdef __USE_BSD# define strsep(s, reject) __strsep (s, reject)# endif#endif/* We need the memory allocation functions for inline strdup(). Referring to stdlib.h (even minimally) is not allowed in any of the tight standards compliant modes. */#ifdef __USE_MISC# if !defined _HAVE_STRING_ARCH_strdup || !defined _HAVE_STRING_ARCH_strndup# define __need_malloc_and_calloc# include <stdlib.h># endif# ifndef _HAVE_STRING_ARCH_strdupextern char *__strdup (__const char *__string) __THROW __attribute_malloc__;# define __strdup(s) \ (__extension__ (__builtin_constant_p (s) && __string2_1bptr_p (s) \ ? (((__const char *) (s))[0] == '\0' \ ? (char *) calloc (1, 1) \ : ({ size_t __len = strlen (s) + 1; \ char *__retval = (char *) malloc (__len); \ if (__retval != NULL) \ __retval = (char *) memcpy (__retval, s, __len); \ __retval; })) \ : __strdup (s)))# if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED# define strdup(s) __strdup (s)# endif# endif# ifndef _HAVE_STRING_ARCH_strndupextern char *__strndup (__const char *__string, size_t __n) __THROW __attribute_malloc__;# define __strndup(s, n) \ (__extension__ (__builtin_constant_p (s) && __string2_1bptr_p (s) \ ? (((__const char *) (s))[0] == '\0' \ ? (char *) calloc (1, 1) \ : ({ size_t __len = strlen (s) + 1; \ size_t __n = (n); \ char *__retval; \ if (__n < __len) \ __len = __n + 1; \ __retval = (char *) malloc (__len); \ if (__retval != NULL) \ { \ __retval[__len - 1] = '\0'; \ __retval = (char *) memcpy (__retval, s, \ __len - 1); \ } \ __retval; })) \ : __strndup (s, n)))# ifdef __USE_GNU# define strndup(s, n) __strndup (s, n)# endif# endif#endif /* Use misc. or use GNU. */#ifndef _FORCE_INLINES# undef __STRING_INLINE#endif#endif /* No string inlines. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -