apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r1575340 - /apr/apr/trunk/include/apr_strings.h
Date Fri, 07 Mar 2014 17:48:51 GMT
Author: wrowe
Date: Fri Mar  7 17:48:50 2014
New Revision: 1575340

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

Modified:
    apr/apr/trunk/include/apr_strings.h

Modified: apr/apr/trunk/include/apr_strings.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_strings.h?rev=1575340&r1=1575339&r2=1575340&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_strings.h (original)
+++ apr/apr/trunk/include/apr_strings.h Fri Mar  7 17:48:50 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);
 



Mime
View raw message