You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2014/03/07 18:49:20 UTC

svn commit: r1575341 - /apr/apr/branches/1.5.x/include/apr_strings.h

Author: wrowe
Date: Fri Mar  7 17:49:19 2014
New Revision: 1575341

URL: http://svn.apache.org/r1575341
Log:
A mechanism to avoid strlen reparsing of newly parsed apr_strtok elements

Modified:
    apr/apr/branches/1.5.x/include/apr_strings.h

Modified: apr/apr/branches/1.5.x/include/apr_strings.h
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/include/apr_strings.h?rev=1575341&r1=1575340&r2=1575341&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/include/apr_strings.h (original)
+++ apr/apr/branches/1.5.x/include/apr_strings.h Fri Mar  7 17:49:19 2014
@@ -235,8 +235,14 @@ APR_DECLARE(apr_status_t) apr_tokenize_t
  *            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);