apr  1.7.0
About: APR (Apache Portable Runtime) project offers software libraries that provide a predictable and consistent interface to underlying platform-specific implementations (APR core library).
  Fossies Dox: apr-1.7.0.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

String routines
Collaboration diagram for String routines:

Modules

 C (POSIX) locale string functions
 
 snprintf implementations
 

Functions

 APR_DECLARE (int) apr_strnatcmp(char const *a
 
 APR_DECLARE (char *) apr_pstrdup(apr_pool_t *p
 
 APR_DECLARE (void *) apr_pmemdup(apr_pool_t *p
 
 APR_DECLARE_NONSTD (char *) apr_pstrcat(apr_pool_t *p
 
const char __attribute__ ((format(printf, 2, 3)))
 
 APR_DECLARE (apr_int64_t) apr_strtoi64(const char *buf
 

Variables

const char * b
 
const char * s
 
const char apr_size_t n
 
const void * m
 
const struct iovec * vec
 
const struct iovec apr_size_t nvec
 
const struct iovec apr_size_t apr_size_t * nbytes
 
const char * fmt
 
const char va_list ap
 
const char * src
 
const char apr_size_t dst_size
 
char *** argv_out
 
char apr_pool_ttoken_context
 
const char * sep
 
const char char ** last
 
const char * buf
 
const char char ** end
 
const char char int base
 

Detailed Description

Function Documentation

◆ __attribute__()

const char __attribute__ ( (format(printf, 2, 3))  )

◆ APR_DECLARE() [1/4]

APR_DECLARE ( apr_int64_t  ) const

parse a numeric string into a 64-bit numeric value

Parameters
bufThe string to parse. It may contain optional whitespace, followed by an optional '+' (positive, default) or '-' (negative) character, followed by an optional '0x' prefix if base is 0 or 16, followed by numeric digits appropriate for base.
endA pointer to the end of the valid character in buf. If not NULL, it is set to the first invalid character in buf.
baseA numeric base in the range between 2 and 36 inclusive, or 0. If base is zero, buf will be treated as base ten unless its digits are prefixed with '0x', in which case it will be treated as base 16.
Returns
The numeric value of the string. On overflow, errno is set to ERANGE. On success, errno is set to 0.

parse a base-10 numeric string into a 64-bit numeric value. Equivalent to apr_strtoi64(buf, (char**)NULL, 10).

Parameters
bufThe string to parse
Returns
The numeric value of the string. On overflow, errno is set to ERANGE. On success, errno is set to 0.

◆ APR_DECLARE() [2/4]

APR_DECLARE ( char *  )

duplicate a string into memory allocated out of a pool

Parameters
pThe pool to allocate out of
sThe string to duplicate
Returns
The new string or NULL if s == NULL

Create a null-terminated string by making a copy of a sequence of characters and appending a null byte

Parameters
pThe pool to allocate out of
sThe block of characters to duplicate
nThe number of characters to duplicate
Returns
The new string or NULL if s == NULL
Remarks
This is a faster alternative to apr_pstrndup(), for use when you know that the string being duplicated really has 'n' or more characters. If the string might contain fewer characters, use apr_pstrndup().

Duplicate at most n characters of a string into memory allocated out of a pool; the new string will be NUL-terminated

Parameters
pThe pool to allocate out of
sThe string to duplicate
nThe maximum number of characters to duplicate
Returns
The new string or NULL if s == NULL
Remarks
The amount of memory allocated from the pool is the length of the returned string including the NUL terminator

Concatenate multiple strings specified in a writev-style vector

Parameters
pThe pool from which to allocate
vecThe strings to concatenate
nvecThe number of strings to concatenate
nbytes(output) strlen of new string (pass in NULL to omit)
Returns
The new string

printf-style style printing routine. The data is output to a string allocated from a pool

Parameters
pThe pool to allocate out of
fmtThe format of the string
apThe arguments to use while printing the data
Returns
The new string

Copy up to dst_size characters from src to dst; does not copy past a NUL terminator in src, but always terminates dst with a NUL regardless.

Parameters
dstThe destination string
srcThe source string
dst_sizeThe space available in dst; dst always receives NUL termination, so if src is longer than dst_size, the actual number of characters copied is dst_size - 1.
Returns
Pointer to the NUL terminator of the destination string, dst
Remarks
Note the differences between this function and strncpy():
 1) strncpy() doesn't always NUL terminate; apr_cpystrn() does.
 2) strncpy() pads the destination string with NULs, which is often 
    unnecessary; apr_cpystrn() does not.
 3) strncpy() returns a pointer to the beginning of the dst string;
    apr_cpystrn() returns a pointer to the NUL terminator of dst, 
    to allow a check for truncation.

Remove all whitespace from a string

Parameters
destThe destination string. It is okay to modify the string in place. Namely dest == src
srcThe string to rid the spaces from.
Returns
A pointer to the destination string's null terminator.

Split a string into separate null-terminated tokens. The tokens are delimited in the string by one or more characters from the sep argument.

Parameters
strThe string to separate; this should be specified on the first call to apr_strtok() for a given string, and NULL on subsequent calls.
sepThe set of delimiters
lastState saved by apr_strtok() between calls.
Returns
The next token from the string
Note
the 'last' state points to the trailing NUL char of the final token, otherwise it points to the character following the current token (all successive or empty occurances of sep are skiped on the subsequent call to apr_strtok). Therefore it is possible to avoid a strlen() determination, with the following logic; toklen = last - retval; if (*last) –toklen;

create a string representation of an int, allocated from a pool

Parameters
pThe pool from which to allocate
nThe number to format
Returns
The string representation of the number

create a string representation of a long, allocated from a pool

Parameters
pThe pool from which to allocate
nThe number to format
Returns
The string representation of the number

create a string representation of an apr_off_t, allocated from a pool

Parameters
pThe pool from which to allocate
nThe number to format
Returns
The string representation of the number

Format a binary size (magnitiudes are 2^10 rather than 10^3) from an apr_off_t, as bytes, K, M, T, etc, to a four character compacted human readable string.

Parameters
sizeThe size to format
bufThe 5 byte text buffer (counting the trailing null)
Returns
The buf passed to apr_strfsize()
Remarks
All negative sizes report ' - ', apr_strfsize only formats positive values.

◆ APR_DECLARE() [3/4]

APR_DECLARE ( int  ) const

Do a natural order comparison of two strings.

Parameters
aThe first string to compare
bThe second string to compare
Returns
Either <0, 0, or >0. If the first string is less than the second this returns <0, if they are equivalent it returns 0, and if the first string is greater than second string it retuns >0.

Do a natural order comparison of two strings ignoring the case of the strings.

Parameters
aThe first string to compare
bThe second string to compare
Returns
Either <0, 0, or >0. If the first string is less than the second this returns <0, if they are equivalent it returns 0, and if the first string is greater than second string it retuns >0.

Convert the arguments to a program from one string to an array of strings terminated by a NULL pointer

Parameters
arg_strThe arguments to convert
argv_outOutput location. This is a pointer to an array of strings.
token_contextPool to use.

vsnprintf routine based on apr_vformatter. This means it understands the same extensions.

Parameters
bufThe buffer to write to
lenThe size of the buffer
formatThe format string
apThe arguments to use to fill out the format string.

Convert a numeric string into an apr_off_t numeric value.

Parameters
offsetThe value of the parsed string.
bufThe string to parse. It may contain optional whitespace, followed by an optional '+' (positive, default) or '-' (negative) character, followed by an optional '0x' prefix if base is 0 or 16, followed by numeric digits appropriate for base.
endA pointer to the end of the valid character in buf. If not NULL, it is set to the first invalid character in buf.
baseA numeric base in the range between 2 and 36 inclusive, or 0. If base is zero, buf will be treated as base ten unless its digits are prefixed with '0x', in which case it will be treated as base 16.
Bug:
*end breaks type safety; where *buf is const, *end needs to be declared as const in APR 2.0

◆ APR_DECLARE() [4/4]

APR_DECLARE ( void *  )

Duplicate a block of memory.

Parameters
pThe pool to allocate from
mThe memory to duplicate
nThe number of bytes to duplicate
Returns
The new block of memory or NULL if m == NULL

Definition at line 70 of file apr_atomic.c.

◆ APR_DECLARE_NONSTD()

APR_DECLARE_NONSTD ( char *  )

Concatenate multiple strings, allocating memory out a pool

Parameters
pThe pool to allocate out of
...The strings to concatenate. The final string must be NULL
Returns
The new string

printf-style style printing routine. The data is output to a string allocated from a pool

Parameters
pThe pool to allocate out of
fmtThe format of the string
...The arguments to use while printing the data
Returns
The new string

Variable Documentation

◆ ap

apr_size_t const char va_list ap

Definition at line 172 of file apr_strings.h.

◆ argv_out

char*** argv_out

Definition at line 227 of file apr_strings.h.

Referenced by APR_DECLARE().

◆ b

const char* b

Definition at line 76 of file apr_strings.h.

◆ base

char int base

Definition at line 335 of file apr_strings.h.

◆ buf

char* buf

Definition at line 335 of file apr_strings.h.

◆ dst_size

const char apr_size_t dst_size

Definition at line 207 of file apr_strings.h.

Referenced by APR_DECLARE().

◆ end

char ** end

Definition at line 335 of file apr_strings.h.

Referenced by APR_DECLARE(), and apr_dir_read().

◆ fmt

const char* fmt

Definition at line 172 of file apr_strings.h.

◆ last

const char char** last

Definition at line 247 of file apr_strings.h.

Referenced by APR_DECLARE(), find_compare(), and skiplisti_find_compare().

◆ m

◆ n

apr_off_t n

Definition at line 109 of file apr_strings.h.

◆ nbytes

const struct iovec apr_size_t apr_size_t* nbytes

Definition at line 161 of file apr_strings.h.

◆ nvec

const struct iovec apr_size_t nvec

Definition at line 161 of file apr_strings.h.

◆ s

◆ sep

const char* sep

Definition at line 247 of file apr_strings.h.

Referenced by APR_DECLARE().

◆ src

const char* src

Definition at line 207 of file apr_strings.h.

◆ token_context

char apr_pool_t* token_context

Definition at line 227 of file apr_strings.h.

Referenced by APR_DECLARE().

◆ vec

const struct iovec* vec

Definition at line 161 of file apr_strings.h.