diff options
author | William A. Rowe Jr <wrowe@apache.org> | 2014-03-07 17:48:50 +0000 |
---|---|---|
committer | William A. Rowe Jr <wrowe@apache.org> | 2014-03-07 17:48:50 +0000 |
commit | f6a7aee18f8fc80477e87c7145a8005fe375cad4 (patch) | |
tree | c371554e407f02bb4519f96bc99106305d037c8f /include/apr_strings.h | |
parent | 77655dfdafd86d8bd613ba5a2ebac69e43c73656 (diff) | |
download | apr-f6a7aee18f8fc80477e87c7145a8005fe375cad4.tar.gz |
A mechanism to avoid strlen reparsing of newly parsed apr_strtok elements
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1575340 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include/apr_strings.h')
-rw-r--r-- | include/apr_strings.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/apr_strings.h b/include/apr_strings.h index ed41931fb..c0642adb2 100644 --- a/include/apr_strings.h +++ b/include/apr_strings.h @@ -235,8 +235,14 @@ APR_DECLARE(apr_status_t) apr_tokenize_to_argv(const char *arg_str, * first call to apr_strtok() for a given string, and NULL * on subsequent calls. * @param sep The set of delimiters - * @param last Internal state saved by apr_strtok() between calls. + * @param last State saved by apr_strtok() between calls. * @return 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; */ APR_DECLARE(char *) apr_strtok(char *str, const char *sep, char **last); |