Back to index

glibc  2.9
Defines | Functions | Variables
string.h File Reference
#include <sys/types.h>
#include <string/string.h>

Go to the source code of this file.

Defines

#define strndupa(s, n)
#define index(s, c)   (strchr ((s), (c)))
#define rindex(s, c)   (strrchr ((s), (c)))

Functions

void * __memccpy (void *__dest, __const void *__src, int __c, size_t __n)
size_t __strnlen (__const char *__string, size_t __maxlen) __attribute_pure__
char * __strsep (char **__stringp, __const char *__delim)
int __strverscmp (__const char *__s1, __const char *__s2) __attribute_pure__
int __strncasecmp (__const char *__s1, __const char *__s2, size_t __n) __attribute_pure__
int __strcasecmp (__const char *__s1, __const char *__s2) __attribute_pure__
char * __strcasestr (__const char *__haystack, __const char *__needle) __attribute_pure__
char * __strdup (__const char *__string) __attribute_malloc__
char * __strndup (__const char *__string, size_t __n) __attribute_malloc__
void * __rawmemchr (__const void *__s, int __c) __attribute_pure__
char * __strchrnul (__const char *__s, int __c) __attribute_pure__
void * __memrchr (__const void *__s, int __c, size_t __n) __attribute_pure__
void * __memchr (__const void *__s, int __c, size_t __n) __attribute_pure__
int __ffs (int __i) __attribute__((const ))
char * __strerror_r (int __errnum, char *__buf, size_t __buflen)
 __typeof (strcoll_l) __strcoll_l
 __typeof (strxfrm_l) __strxfrm_l
 __typeof (strcasecmp_l) __strcasecmp_l
 __typeof (strncasecmp_l) __strncasecmp_l
 libc_hidden_proto (__mempcpy) libc_hidden_proto(__stpcpy) libc_hidden_proto(__stpncpy) libc_hidden_proto(__rawmemchr) libc_hidden_proto(__strcasecmp) libc_hidden_proto(__strcasecmp_l) libc_hidden_proto(__strncasecmp_l) libc_hidden_proto(__strdup) libc_hidden_proto(__strndup) libc_hidden_proto(__strerror_r) libc_hidden_proto(__strverscmp) libc_hidden_proto(basename) libc_hidden_proto(strcoll) libc_hidden_proto(__strcoll_l) libc_hidden_proto(__strxfrm_l) libc_hidden_proto(__strtok_r) extern char *__strsep_g(char **__stringp
 libc_hidden_proto (__strsep_g) libc_hidden_proto(strnlen) libc_hidden_builtin_proto(memchr) libc_hidden_builtin_proto(memcpy) libc_hidden_builtin_proto(mempcpy) libc_hidden_builtin_proto(memcmp) libc_hidden_builtin_proto(memmove) libc_hidden_builtin_proto(memset) libc_hidden_builtin_proto(strcat) libc_hidden_builtin_proto(strchr) libc_hidden_builtin_proto(strcmp) libc_hidden_builtin_proto(strcpy) libc_hidden_builtin_proto(strcspn) libc_hidden_builtin_proto(strlen) libc_hidden_builtin_proto(strncmp) libc_hidden_builtin_proto(strncpy) libc_hidden_builtin_proto(strpbrk) libc_hidden_builtin_proto(stpcpy) libc_hidden_builtin_proto(strrchr) libc_hidden_builtin_proto(strspn) libc_hidden_builtin_proto(strstr) libc_hidden_builtin_proto(ffs) extern void *__memcpy_chk(void *__restrict __dest
void * __memmove_chk (void *__dest, const void *__src, size_t __len, size_t __destlen) __THROW
void * __mempcpy_chk (void *__restrict __dest, const void *__restrict __src, size_t __len, size_t __destlen) __THROW
void * __memset_chk (void *__dest, int __ch, size_t __len, size_t __destlen) __THROW
char * __strcpy_chk (char *__restrict __dest, const char *__restrict __src, size_t __destlen) __THROW
char * __stpcpy_chk (char *__restrict __dest, const char *__restrict __src, size_t __destlen) __THROW
char * __strncpy_chk (char *__restrict __dest, const char *__restrict __src, size_t __len, size_t __destlen) __THROW
char * __strcat_chk (char *__restrict __dest, const char *__restrict __src, size_t __destlen) __THROW
char * __strncat_chk (char *__restrict __dest, const char *__restrict __src, size_t __len, size_t __destlen) __THROW

Variables

__const char * __delim
const void *__restrict __src
const void *__restrict size_t __len
const void *__restrict size_t
size_t __destlen 
__THROW

Define Documentation

#define index (   s,
  c 
)    (strchr ((s), (c)))
#define rindex (   s,
  c 
)    (strrchr ((s), (c)))
#define strndupa (   s,
  n 
)
Value:
(__extension__                                                       \
    ({                                                               \
      __const char *__old = (s);                                     \
      size_t __len = __strnlen (__old, (n));                                \
      char *__new = (char *) __builtin_alloca (__len + 1);                  \
      __new[__len] = '\0';                                           \
      (char *) memcpy (__new, __old, __len);                                \
    }))

Definition at line 59 of file string.h.


Function Documentation

int __ffs ( int  __i) const

Here is the caller graph for this function:

void* __memccpy ( void *  __dest,
__const void *  __src,
int  __c,
size_t  __n 
)

Here is the caller graph for this function:

void* __memchr ( __const void *  __s,
int  __c,
size_t  __n 
)
void* __memmove_chk ( void *  __dest,
const void *  __src,
size_t  __len,
size_t  __destlen 
)

Definition at line 27 of file memmove_chk.c.

{
  if (__builtin_expect (destlen < len, 0))
    __chk_fail ();

  unsigned long int dstp = (long int) dest;
  unsigned long int srcp = (long int) src;

  /* This test makes the forward copying code be used whenever possible.
     Reduces the working set.  */
  if (dstp - srcp >= len)   /* *Unsigned* compare!  */
    {
      /* Copy from the beginning to the end.  */

      /* If there not too few bytes to copy, use word copy.  */
      if (len >= OP_T_THRES)
       {
         /* Copy just a few bytes to make DSTP aligned.  */
         len -= (-dstp) % OPSIZ;
         BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);

         /* Copy whole pages from SRCP to DSTP by virtual address
            manipulation, as much as possible.  */

         PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);

         /* Copy from SRCP to DSTP taking advantage of the known
            alignment of DSTP.  Number of bytes remaining is put
            in the third argument, i.e. in LEN.  This number may
            vary from machine to machine.  */

         WORD_COPY_FWD (dstp, srcp, len, len);

         /* Fall out and copy the tail.  */
       }

      /* There are just a few bytes to copy.  Use byte memory operations.  */
      BYTE_COPY_FWD (dstp, srcp, len);
    }
  else
    {
      /* Copy from the end to the beginning.  */
      srcp += len;
      dstp += len;

      /* If there not too few bytes to copy, use word copy.  */
      if (len >= OP_T_THRES)
       {
         /* Copy just a few bytes to make DSTP aligned.  */
         len -= dstp % OPSIZ;
         BYTE_COPY_BWD (dstp, srcp, dstp % OPSIZ);

         /* Copy from SRCP to DSTP taking advantage of the known
            alignment of DSTP.  Number of bytes remaining is put
            in the third argument, i.e. in LEN.  This number may
            vary from machine to machine.  */

         WORD_COPY_BWD (dstp, srcp, len, len);

         /* Fall out and copy the tail.  */
       }

      /* There are just a few bytes to copy.  Use byte memory operations.  */
      BYTE_COPY_BWD (dstp, srcp, len);
    }

  return dest;
}

Here is the call graph for this function:

void* __mempcpy_chk ( void *__restrict  __dest,
const void *__restrict  __src,
size_t  __len,
size_t  __destlen 
)
void* __memrchr ( __const void *  __s,
int  __c,
size_t  __n 
)
void* __memset_chk ( void *  __dest,
int  __ch,
size_t  __len,
size_t  __destlen 
)

Definition at line 23 of file memset_chk.c.

{
  if (__builtin_expect (dstlen < len, 0))
    __chk_fail ();

  long int dstp = (long int) dstpp;

  if (len >= 8)
    {
      size_t xlen;
      op_t cccc;

      cccc = (unsigned char) c;
      cccc |= cccc << 8;
      cccc |= cccc << 16;
      if (OPSIZ > 4)
       /* Do the shift in two steps to avoid warning if long has 32 bits.  */
       cccc |= (cccc << 16) << 16;

      /* There are at least some bytes to set.
        No need to test for LEN == 0 in this alignment loop.  */
      while (dstp % OPSIZ != 0)
       {
         ((byte *) dstp)[0] = c;
         dstp += 1;
         len -= 1;
       }

      /* Write 8 `op_t' per iteration until less than 8 `op_t' remain.  */
      xlen = len / (OPSIZ * 8);
      while (xlen > 0)
       {
         ((op_t *) dstp)[0] = cccc;
         ((op_t *) dstp)[1] = cccc;
         ((op_t *) dstp)[2] = cccc;
         ((op_t *) dstp)[3] = cccc;
         ((op_t *) dstp)[4] = cccc;
         ((op_t *) dstp)[5] = cccc;
         ((op_t *) dstp)[6] = cccc;
         ((op_t *) dstp)[7] = cccc;
         dstp += 8 * OPSIZ;
         xlen -= 1;
       }
      len %= OPSIZ * 8;

      /* Write 1 `op_t' per iteration until less than OPSIZ bytes remain.  */
      xlen = len / OPSIZ;
      while (xlen > 0)
       {
         ((op_t *) dstp)[0] = cccc;
         dstp += OPSIZ;
         xlen -= 1;
       }
      len %= OPSIZ;
    }

  /* Write the last few bytes.  */
  while (len > 0)
    {
      ((byte *) dstp)[0] = c;
      dstp += 1;
      len -= 1;
    }

  return dstpp;
}

Here is the call graph for this function:

void* __rawmemchr ( __const void *  __s,
int  __c 
)
char* __stpcpy_chk ( char *__restrict  __dest,
const char *__restrict  __src,
size_t  __destlen 
)
int __strcasecmp ( __const char *  __s1,
__const char *  __s2 
)
char* __strcasestr ( __const char *  __haystack,
__const char *  __needle 
)
char* __strcat_chk ( char *__restrict  __dest,
const char *__restrict  __src,
size_t  __destlen 
)
char* __strchrnul ( __const char *  __s,
int  __c 
)
char* __strcpy_chk ( char *__restrict  __dest,
const char *__restrict  __src,
size_t  __destlen 
)
char* __strdup ( __const char *  __string)
char* __strerror_r ( int  __errnum,
char *  __buf,
size_t  __buflen 
)

Definition at line 171 of file dl-minimal.c.

{
  char *msg;

  switch (errnum)
    {
    case ENOMEM:
      msg = (char *) "Cannot allocate memory";
      break;
    case EINVAL:
      msg = (char *) "Invalid argument";
      break;
    case ENOENT:
      msg = (char *) "No such file or directory";
      break;
    case EPERM:
      msg = (char *) "Operation not permitted";
      break;
    case EIO:
      msg = (char *) "Input/output error";
      break;
    case EACCES:
      msg = (char *) "Permission denied";
      break;
    default:
      /* No need to check buffer size, all calls in the dynamic linker
        provide enough space.  */
      buf[buflen - 1] = '\0';
      msg = _itoa (errnum, buf + buflen - 1, 10, 0);
      msg = memcpy (msg - (sizeof ("Error ") - 1), "Error ",
                  sizeof ("Error ") - 1);
      break;
    }

  return msg;
}

Here is the call graph for this function:

int __strncasecmp ( __const char *  __s1,
__const char *  __s2,
size_t  __n 
)
char* __strncat_chk ( char *__restrict  __dest,
const char *__restrict  __src,
size_t  __len,
size_t  __destlen 
)
char* __strncpy_chk ( char *__restrict  __dest,
const char *__restrict  __src,
size_t  __len,
size_t  __destlen 
)
char* __strndup ( __const char *  __string,
size_t  __n 
)
size_t __strnlen ( __const char *  __string,
size_t  __maxlen 
)

Here is the caller graph for this function:

char* __strsep ( char **  __stringp,
__const char *  __delim 
)
int __strverscmp ( __const char *  __s1,
__const char *  __s2 
)

Here is the caller graph for this function:

__typeof ( strcoll_l  )
__typeof ( strxfrm_l  )
__typeof ( strcasecmp_l  )
__typeof ( strncasecmp_l  )

Variable Documentation

Definition at line 86 of file string.h.

Definition at line 121 of file string.h.

Definition at line 121 of file string.h.

Definition at line 121 of file string.h.