Back to index

glibc  2.9
Defines | Functions
string2.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define __STRING_INLINE   __extern_inline
#define __STRING2_COPY_TYPE(N)
#define __string2_1bptr_p(__x)   ((size_t)(const void *)((__x) + 1) - (size_t)(const void *)(__x) == 1)
#define memset(s, c, n)
#define strchr(s, c)
#define strncpy(dest, src, n)
#define strncat(dest, src, n)
#define strcmp(s1, s2)
#define __strcmp_cc(s1, s2, l)
#define __strcmp_cg(s1, s2, l1)
#define __strcmp_gc(s1, s2, l2)
#define strncmp(s1, s2, n)
#define strcspn(s, reject)
#define strspn(s, accept)
#define strpbrk(s, accept)
#define strstr(haystack, needle)
#define __strtok_r(s, sep, nextp)
#define __strsep(s, reject)

Functions

 __STRING2_COPY_TYPE (2)
 __STRING2_COPY_TYPE (3)
 __STRING2_COPY_TYPE (4)
 __STRING2_COPY_TYPE (5)
 __STRING2_COPY_TYPE (6)
 __STRING2_COPY_TYPE (7)
 __STRING2_COPY_TYPE (8)
void * __rawmemchr (const void *__s, int __c)
__STRING_INLINE size_t __strcspn_c1 (__const char *__s, int __reject)
__STRING_INLINE size_t __strcspn_c2 (__const char *__s, int __reject1, int __reject2)
__STRING_INLINE size_t __strcspn_c3 (__const char *__s, int __reject1, int __reject2, int __reject3)
__STRING_INLINE size_t __strspn_c1 (__const char *__s, int __accept)
__STRING_INLINE size_t __strspn_c2 (__const char *__s, int __accept1, int __accept2)
__STRING_INLINE size_t __strspn_c3 (__const char *__s, int __accept1, int __accept2, int __accept3)
__STRING_INLINE char * __strpbrk_c2 (__const char *__s, int __accept1, int __accept2)
__STRING_INLINE char * __strpbrk_c3 (__const char *__s, int __accept1, int __accept2, int __accept3)
__STRING_INLINE char * __strtok_r_1c (char *__s, char __sep, char **__nextp)
char * __strsep_g (char **__stringp, __const char *__delim)
__STRING_INLINE char * __strsep_1c (char **__s, char __reject)
__STRING_INLINE char * __strsep_2c (char **__s, char __reject1, char __reject2)
__STRING_INLINE char * __strsep_3c (char **__s, char __reject1, char __reject2, char __reject3)

Define Documentation

#define __strcmp_cc (   s1,
  s2,
  l 
)
Value:
(__extension__ ({ register int __result =                            \
                    (((__const unsigned char *) (__const char *) (s1))[0]   \
                     - ((__const unsigned char *) (__const char *)(s2))[0]);\
                  if (l > 0 && __result == 0)                               \
                    {                                                       \
                     __result = (((__const unsigned char *)                 \
                                 (__const char *) (s1))[1]                  \
                                - ((__const unsigned char *)         \
                                   (__const char *) (s2))[1]);       \
                     if (l > 1 && __result == 0)                     \
                       {                                             \
                         __result =                                         \
                           (((__const unsigned char *)               \
                            (__const char *) (s1))[2]                \
                            - ((__const unsigned char *)                    \
                              (__const char *) (s2))[2]);                   \
                         if (l > 2 && __result == 0)                        \
                           __result =                                \
                            (((__const unsigned char *)              \
                              (__const char *) (s1))[3]              \
                             - ((__const unsigned char *)                   \
                                (__const char *) (s2))[3]);                 \
                       }                                             \
                    }                                                       \
                  __result; }))

Definition at line 842 of file string2.h.

#define __strcmp_cg (   s1,
  s2,
  l1 
)
Value:
(__extension__ ({ __const unsigned char *__s2 =                      \
                    (__const unsigned char *) (__const char *) (s2);        \
                  register int __result =                            \
                    (((__const unsigned char *) (__const char *) (s1))[0]   \
                     - __s2[0]);                                     \
                  if (l1 > 0 && __result == 0)                       \
                    {                                                       \
                     __result = (((__const unsigned char *)                 \
                                 (__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; }))

Definition at line 869 of file string2.h.

#define __strcmp_gc (   s1,
  s2,
  l2 
)
Value:
(__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; }))

Definition at line 891 of file string2.h.

#define __string2_1bptr_p (   __x)    ((size_t)(const void *)((__x) + 1) - (size_t)(const void *)(__x) == 1)

Definition at line 93 of file string2.h.

#define __STRING2_COPY_TYPE (   N)
Value:
typedef struct { unsigned char __arr[N]; }                                  \
    __attribute__ ((__packed__)) __STRING2_COPY_ARR##N

Definition at line 77 of file string2.h.

Definition at line 46 of file string2.h.

#define __strsep (   s,
  reject 
)
Value:
__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)); })

Definition at line 1205 of file string2.h.

#define __strtok_r (   s,
  sep,
  nextp 
)
Value:
(__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)))

Definition at line 1164 of file string2.h.

#define memset (   s,
  c,
  n 
)
Value:
(__extension__ (__builtin_constant_p (c) && (c) == '\0'              \
                ? ({ void *__s = (s); __bzero (__s, n); __s; })             \
                : memset (s, c, n)))

Definition at line 182 of file string2.h.

#define strchr (   s,
  c 
)
Value:
(__extension__ (__builtin_constant_p (c) && (c) == '\0'              \
                ? (char *) __rawmemchr (s, c)                               \
                : strchr (s, c)))

Definition at line 402 of file string2.h.

#define strcmp (   s1,
  s2 
)
Value:
__extension__                                                        \
  ({ size_t __s1_len, __s2_len;                                             \
     (__builtin_constant_p (s1) && __builtin_constant_p (s2)                \
      && (__s1_len = strlen (s1), __s2_len = strlen (s2),                   \
         (!__string2_1bptr_p (s1) || __s1_len >= 4)                         \
         && (!__string2_1bptr_p (s2) || __s2_len >= 4))              \
      ? memcmp ((__const char *) (s1), (__const char *) (s2),               \
              (__s1_len < __s2_len ? __s1_len : __s2_len) + 1)       \
      : (__builtin_constant_p (s1) && __string2_1bptr_p (s1)                \
        && (__s1_len = strlen (s1), __s1_len < 4)                           \
        ? (__builtin_constant_p (s2) && __string2_1bptr_p (s2)              \
           ? __strcmp_cc (s1, s2, __s1_len)                                 \
           : __strcmp_cg (s1, s2, __s1_len))                                \
        : (__builtin_constant_p (s2) && __string2_1bptr_p (s2)              \
           && (__s2_len = strlen (s2), __s2_len < 4)                        \
           ? (__builtin_constant_p (s1) && __string2_1bptr_p (s1)           \
              ? __strcmp_cc (s1, s2, __s2_len)                              \
              : __strcmp_gc (s1, s2, __s2_len))                      \
           : strcmp (s1, s2)))); })

Definition at line 820 of file string2.h.

#define strcspn (   s,
  reject 
)
Value:
__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)); })

Definition at line 952 of file string2.h.

#define strncat (   dest,
  src,
  n 
)
Value:
(__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n)      \
                ? (strlen (src) < ((size_t) (n))                     \
                   ? strcat (dest, src)                              \
                   : strncat (dest, src, n))                                \
                : strncat (dest, src, n)))

Definition at line 787 of file string2.h.

#define strncmp (   s1,
  s2,
  n 
)
Value:
(__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)))

Definition at line 920 of file string2.h.

#define strncpy (   dest,
  src,
  n 
)
Value:
(__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n)      \
                ? (strlen (src) + 1 >= ((size_t) (n))                       \
                   ? (char *) memcpy (dest, src, n)                         \
                   : strncpy (dest, src, n))                                \
                : strncpy (dest, src, n)))

Definition at line 763 of file string2.h.

#define strpbrk (   s,
  accept 
)
Value:
__extension__                                                        \
  ({ char __a0, __a1, __a2;                                          \
     (__builtin_constant_p (accept) && __string2_1bptr_p (accept)           \
      ? ((__a0 = ((__const char  *) (accept))[0], __a0 == '\0')                    \
        ? ((void) (s), (char *) 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)); })

Definition at line 1104 of file string2.h.

#define strspn (   s,
  accept 
)
Value:
__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)); })

Definition at line 1028 of file string2.h.

#define strstr (   haystack,
  needle 
)
Value:
(__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)))

Definition at line 1150 of file string2.h.


Function Documentation

void* __rawmemchr ( const void *  __s,
int  __c 
)
__STRING_INLINE size_t __strcspn_c1 ( __const char *  __s,
int  __reject 
)

Definition at line 971 of file string2.h.

{
  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 
)

Definition at line 982 of file string2.h.

{
  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 
)

Definition at line 994 of file string2.h.

{
  register size_t __result = 0;
  while (__s[__result] != '\0' && __s[__result] != __reject1
        && __s[__result] != __reject2 && __s[__result] != __reject3)
    ++__result;
  return __result;
}
__STRING_INLINE char * __strpbrk_c2 ( __const char *  __s,
int  __accept1,
int  __accept2 
)

Definition at line 1124 of file string2.h.

{
  /* 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 
)

Definition at line 1135 of file string2.h.

{
  /* 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;
}
__STRING_INLINE char * __strsep_1c ( char **  __s,
char  __reject 
)

Definition at line 1224 of file string2.h.

{
  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 
)

Definition at line 1234 of file string2.h.

{
  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 
)

Definition at line 1262 of file string2.h.

{
  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;
}
char* __strsep_g ( char **  __stringp,
__const char *  __delim 
)
__STRING_INLINE size_t __strspn_c1 ( __const char *  __s,
int  __accept 
)

Definition at line 1047 of file string2.h.

{
  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 
)

Definition at line 1059 of file string2.h.

{
  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 
)

Definition at line 1071 of file string2.h.

{
  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;
}
__STRING_INLINE char * __strtok_r_1c ( char *  __s,
char  __sep,
char **  __nextp 
)

Definition at line 1174 of file string2.h.

{
  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;
}