[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1224647 - in /subversion/trunk/subversion: include/svn_string.h libsvn_fs_base/id.c libsvn_fs_fs/fs_fs.c libsvn_fs_fs/id.c libsvn_fs_fs/tree.c libsvn_ra_neon/session.c libsvn_ra_serf/serf.c libsvn_ra_serf/util.c libsvn_subr/svn_string.c

From: Travis <svn_at_castle.fastmail.fm>
Date: Fri, 6 Jan 2012 16:49:58 -0600

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).
>
...
> +char *
> +svn_cstring_tokenize(const char *sep, char **str)
> +{
> + char *token;
> + const char * next;
> + char csep;
> +
> + /* let APR handle edge cases and multiple separators */
> + csep = *sep;
> + if (csep == '\0' || sep[2] != '\0')
> + return apr_strtok(NULL, sep, str);
> +

Entirely possible that I'm not understanding, but shouldn't that be

   sep[1] != '\0'

if you're trying to pass on the case where sep is > 1 character to
apr_strtok()?
In the exactly-1-char case:
   sep[0] = <the char of interest>
   sep[1] = 0
   sep[2] = <unknown value>

-Travis
Received on 2012-01-06 23:50:35 CET

This is an archived mail posted to the Subversion Dev mailing list.