diff options
Diffstat (limited to 'subversion/include/svn_string.h')
-rw-r--r-- | subversion/include/svn_string.h | 91 |
1 files changed, 72 insertions, 19 deletions
diff --git a/subversion/include/svn_string.h b/subversion/include/svn_string.h index d8ce02b..82c6fd6 100644 --- a/subversion/include/svn_string.h +++ b/subversion/include/svn_string.h @@ -140,6 +140,8 @@ svn_string_create_empty(apr_pool_t *pool); /** Create a new string copied from a generic string of bytes, @a bytes, of * length @a size bytes. @a bytes is NOT assumed to be null-terminated, but * the new string will be. + * + * @since Since 1.9, @a bytes can be NULL if @a size is zero. */ svn_string_t * svn_string_ncreate(const char *bytes, apr_size_t size, apr_pool_t *pool); @@ -168,7 +170,11 @@ svn_string_createv(apr_pool_t *pool, const char *fmt, va_list ap) svn_boolean_t svn_string_isempty(const svn_string_t *str); -/** Return a duplicate of @a original_string. */ +/** Return a duplicate of @a original_string. + * + * @since Since 1.9, @a original_string can be NULL in which case NULL will + * be returned. + */ svn_string_t * svn_string_dup(const svn_string_t *original_string, apr_pool_t *pool); @@ -205,6 +211,8 @@ svn_stringbuf_create(const char *cstring, apr_pool_t *pool); /** Create a new stringbuf copied from the generic string of bytes, @a bytes, * of length @a size bytes. @a bytes is NOT assumed to be null-terminated, * but the new stringbuf will be. + * + * @since Since 1.9, @a bytes can be NULL if @a size is zero. */ svn_stringbuf_t * svn_stringbuf_ncreate(const char *bytes, apr_size_t size, apr_pool_t *pool); @@ -232,6 +240,15 @@ svn_stringbuf_create_ensure(apr_size_t minimum_size, apr_pool_t *pool); svn_stringbuf_t * svn_stringbuf_create_from_string(const svn_string_t *str, apr_pool_t *pool); +/** Create a new stringbuf using the given @a str as initial buffer. + * Allocate the result in @a pool. In contrast to #svn_stringbuf_create, + * the contents of @a str may change when the stringbuf gets modified. + * + * @since New in 1.9 + */ +svn_stringbuf_t * +svn_stringbuf_create_wrap(char *str, apr_pool_t *pool); + /** Create a new stringbuf by printf-style formatting using @a fmt and the * variable arguments, which are as appropriate for apr_psprintf(). */ @@ -288,25 +305,37 @@ svn_stringbuf_fillchar(svn_stringbuf_t *str, unsigned char c); * The advantages extend beyond the actual call because the reduced * register pressure allows for more optimization within the caller. * - * reallocs if necessary. @a targetstr is affected, nothing else is. + * Reallocs if necessary. @a targetstr is affected, nothing else is. * @since New in 1.7. */ void svn_stringbuf_appendbyte(svn_stringbuf_t *targetstr, char byte); -/** Append an array of bytes onto @a targetstr. +/** Append the array of bytes @a bytes of length @a count onto @a targetstr. * - * reallocs if necessary. @a targetstr is affected, nothing else is. + * Reallocs if necessary. @a targetstr is affected, nothing else is. + * + * @since 1.9 @a bytes can be NULL if @a count is zero. */ void svn_stringbuf_appendbytes(svn_stringbuf_t *targetstr, const char *bytes, apr_size_t count); +/** Append @a byte @a count times onto @a targetstr. + * + * Reallocs if necessary. @a targetstr is affected, nothing else is. + * @since New in 1.9. + */ +void +svn_stringbuf_appendfill(svn_stringbuf_t *targetstr, + char byte, + apr_size_t count); + /** Append the stringbuf @c appendstr onto @a targetstr. * - * reallocs if necessary. @a targetstr is affected, nothing else is. + * Reallocs if necessary. @a targetstr is affected, nothing else is. */ void svn_stringbuf_appendstr(svn_stringbuf_t *targetstr, @@ -314,22 +343,25 @@ svn_stringbuf_appendstr(svn_stringbuf_t *targetstr, /** Append the C string @a cstr onto @a targetstr. * - * reallocs if necessary. @a targetstr is affected, nothing else is. + * Reallocs if necessary. @a targetstr is affected, nothing else is. */ void svn_stringbuf_appendcstr(svn_stringbuf_t *targetstr, const char *cstr); -/** Read @a count bytes from @a bytes and insert them into @a str at - * position @a pos and following. The resulting string will be - * @c count+str->len bytes long. If @c pos is larger or equal to the - * number of bytes currently used in @a str, simply append @a bytes. +/** Insert into @a str at position @a pos an array of bytes @a bytes + * which is @a count bytes long. + * + * The resulting string will be @c count+str->len bytes long. If + * @a pos is larger than or equal to @c str->len, simply append @a bytes. * * Reallocs if necessary. @a str is affected, nothing else is. * - * @note The inserted string may be a sub-range if @a str. + * @note The inserted string may be a sub-range of @a str. * * @since New in 1.8. + * + * @since Since 1.9, @a bytes can be NULL if @a count is zero. */ void svn_stringbuf_insert(svn_stringbuf_t *str, @@ -337,9 +369,10 @@ svn_stringbuf_insert(svn_stringbuf_t *str, const char *bytes, apr_size_t count); -/** Removes @a count bytes from @a str, starting at position @a pos. - * If that range exceeds the current string data, @a str gets truncated - * at @a pos. If the latter is larger or equal to @c str->pos, this will +/** Remove @a count bytes from @a str, starting at position @a pos. + * + * If that range exceeds the current string data, truncate @a str at + * @a pos. If @a pos is larger than or equal to @c str->len, this will * be a no-op. Otherwise, the resulting string will be @c str->len-count * bytes long. * @@ -351,8 +384,8 @@ svn_stringbuf_remove(svn_stringbuf_t *str, apr_size_t count); /** Replace in @a str the substring which starts at @a pos and is @a - * old_count bytes long with a new substring @a bytes (which is @a - * new_count bytes long). + * old_count bytes long with a new substring @a bytes which is @a + * new_count bytes long. * * This is faster but functionally equivalent to the following sequence: * @code @@ -361,6 +394,8 @@ svn_stringbuf_remove(svn_stringbuf_t *str, * @endcode * * @since New in 1.8. + * + * @since Since 1.9, @a bytes can be NULL if @a new_count is zero. */ void svn_stringbuf_replace(svn_stringbuf_t *str, @@ -407,9 +442,11 @@ svn_string_compare_stringbuf(const svn_string_t *str1, * @{ */ -/** Divide @a input into substrings along @a sep_chars boundaries, return an - * array of copies of those substrings (plain const char*), allocating both - * the array and the copies in @a pool. +/** Divide @a input into substrings, interpreting any char from @a sep + * as a token separator. + * + * Return an array of copies of those substrings (plain const char*), + * allocating both the array and the copies in @a pool. * * None of the elements added to the array contain any of the * characters in @a sep_chars, and none of the new elements are empty @@ -504,6 +541,7 @@ svn_cstring_casecmp(const char *str1, const char *str2); * Assume that the number is represented in base @a base. * Raise an error if conversion fails (e.g. due to overflow), or if the * converted number is smaller than @a minval or larger than @a maxval. + * Leading whitespace in @a str is skipped in a locale-dependent way. * * @since New in 1.7. */ @@ -516,6 +554,7 @@ svn_cstring_strtoi64(apr_int64_t *n, const char *str, * Parse the C string @a str into a 64 bit number, and return it in @a *n. * Assume that the number is represented in base 10. * Raise an error if conversion fails (e.g. due to overflow). + * Leading whitespace in @a str is skipped in a locale-dependent way. * * @since New in 1.7. */ @@ -526,6 +565,7 @@ svn_cstring_atoi64(apr_int64_t *n, const char *str); * Parse the C string @a str into a 32 bit number, and return it in @a *n. * Assume that the number is represented in base 10. * Raise an error if conversion fails (e.g. due to overflow). + * Leading whitespace in @a str is skipped in a locale-dependent way. * * @since New in 1.7. */ @@ -537,6 +577,7 @@ svn_cstring_atoi(int *n, const char *str); * it in @a *n. Assume that the number is represented in base @a base. * Raise an error if conversion fails (e.g. due to overflow), or if the * converted number is smaller than @a minval or larger than @a maxval. + * Leading whitespace in @a str is skipped in a locale-dependent way. * * @since New in 1.7. */ @@ -549,6 +590,7 @@ svn_cstring_strtoui64(apr_uint64_t *n, const char *str, * Parse the C string @a str into an unsigned 64 bit number, and return * it in @a *n. Assume that the number is represented in base 10. * Raise an error if conversion fails (e.g. due to overflow). + * Leading whitespace in @a str is skipped in a locale-dependent way. * * @since New in 1.7. */ @@ -559,12 +601,23 @@ svn_cstring_atoui64(apr_uint64_t *n, const char *str); * Parse the C string @a str into an unsigned 32 bit number, and return * it in @a *n. Assume that the number is represented in base 10. * Raise an error if conversion fails (e.g. due to overflow). + * Leading whitespace in @a str is skipped in a locale-dependent way. * * @since New in 1.7. */ svn_error_t * svn_cstring_atoui(unsigned int *n, const char *str); +/** + * Skip the common prefix @a prefix from the C string @a str, and return + * a pointer to the next character after the prefix. + * Return @c NULL if @a str does not start with @a prefix. + * + * @since New in 1.9. + */ +const char * +svn_cstring_skip_prefix(const char *str, const char *prefix); + /** @} */ /** @} */ |