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

Re: svn commit: r1362480 - /subversion/trunk/subversion/libsvn_fs/fs-loader.c

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Wed, 18 Jul 2012 00:50:35 +0100

Blair Zajac wrote on Tue, Jul 17, 2012 at 09:48:25 -0700:
> On 7/17/12 6:17 AM, philip_at_apache.org wrote:
> >Author: philip
> >Date: Tue Jul 17 13:17:34 2012
> >New Revision: 1362480
> >
> >URL: http://svn.apache.org/viewvc?rev=1362480&view=rev
> >Log:
> >* subversion/libsvn_fs/fs-loader.c
> > (load_module): Only allow alphanumeric characters in name.
> >
>
> > apr_status_t status;
> >+ apr_size_t i;
> >+
> >+ /* Demand a simple alphanumeric name so that the generated DSO
> >+ name is sensible. */
> >+ for (i = 0; i < strlen(name); ++i)
> >+ if (!svn_ctype_isalnum(name[i]))
> >+ return svn_error_createf(SVN_ERR_FS_UNKNOWN_FS_TYPE, NULL,
> >+ _("Invalid name for FS type '%s'"),
> >+ name);
>
> This code doesn't probably get run often, but generally it's better
> to iterate through name using pointers instead of strlen() since the
> later scans the string twice.
>

Once per iteration of the loop...

(Yes, you both know this, but http://xkcd.com/386/)

> Blair
>
>
Received on 2012-07-18 01:51:11 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.