On 06.01.2012 19:06, Daniel Shahaf wrote:
> Stefan,
>
> stefan2_at_apache.org wrote on Sun, Dec 25, 2011 at 21:40:37 -0000:
>> Author: stefan2
>> Date: Sun Dec 25 21:40:37 2011
>> New Revision: 1224647
>>
>> URL: http://svn.apache.org/viewvc?rev=1224647&view=rev
>> Log:
>> Improve parsing speed of IDs and other structures by introducing
>> a wrapper around apr_strtok(). Since the latter has abysmal
>> performance if the number of separators is small, the new wrapper
>> uses its own implementation for the frequent case that there is
>> exactly one separator.
>>
>> Replace calls to apr_strtok with calls to the new function if there
>> is the separator string may contain just one char (not always known
>> for pass-through parameters).
>>
> ...
>> Modified: subversion/trunk/subversion/libsvn_ra_neon/session.c
>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/session.c?rev=1224647&r1=1224646&r2=1224647&view=diff
>> ==============================================================================
>> --- subversion/trunk/subversion/libsvn_ra_neon/session.c (original)
>> +++ subversion/trunk/subversion/libsvn_ra_neon/session.c Sun Dec 25 21:40:37 2011
>> @@ -590,10 +590,10 @@ static svn_error_t *get_server_settings(
>> #ifdef SVN_NEON_0_26
>> if (http_auth_types)
>> {
>> - char *token, *last;
>> + char *token;
>> char *auth_types_list = apr_palloc(pool, strlen(http_auth_types) + 1);
>> apr_collapse_spaces(auth_types_list, http_auth_types);
>> - while ((token = apr_strtok(auth_types_list, ";",&last)) != NULL)
>> + while ((token = svn_cstring_tokenize(";",&auth_types_list)) != NULL)
>> {
>> auth_types_list = NULL;
>> if (svn_cstring_casecmp("basic", token) == 0)
>> @@ -985,10 +985,10 @@ svn_ra_neon__open(svn_ra_session_t *sess
>>
>> if (authorities != NULL)
>> {
>> - char *files, *file, *last;
>> + char *files, *file;
>> files = apr_pstrdup(pool, authorities);
>>
>> - while ((file = apr_strtok(files, ";",&last)) != NULL)
>> + while ((file = svn_cstring_tokenize(";",&files)) != NULL)
>> {
>> ne_ssl_certificate *ca_cert;
>> files = NULL;
> This code will segfault on the second iteration of the loop.
>
> Philip fixed this instance in r1228310. Please fix the remaining
> instances in the other callers to svn_cstring_tokenize().
Done in r1228602.
-- Stefan^2.
Received on 2012-01-09 02:38:18 CET