summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2014-03-07 17:49:19 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2014-03-07 17:49:19 +0000
commitfcd6f1683a42f841732fd8f49273f84e4536b516 (patch)
treec3d4c632c84139dc073c259cbd5fbcb2bc428856 /include
parent41b846d4e4dfc9d5e5ce3942623dc9bed098b4d9 (diff)
downloadlibapr-fcd6f1683a42f841732fd8f49273f84e4536b516.tar.gz
A mechanism to avoid strlen reparsing of newly parsed apr_strtok elements
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1575341 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r--include/apr_strings.h8
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);