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

Re: svn commit: rev 7707 - branches/issue-1429-dev/subversion/mod_dav_svn

From: Greg Stein <gstein_at_lyra.org>
Date: 2003-11-12 01:22:21 CET

On Tue, Nov 11, 2003 at 05:58:02PM -0600, kfogel@tigris.org wrote:
>...
> +++ branches/issue-1429-dev/subversion/mod_dav_svn/update.c Tue Nov 11 17:58:01 2003
> @@ -719,10 +719,13 @@
> {
> if (value)
> {
> - const svn_string_t *qval = value;
> + const svn_string_t *qval;
>
> if (svn_xml_is_xml_safe(value->data, value->len))
> {
> + svn_stringbuf_t *tmp = NULL;
> + svn_xml_escape_cdata_string(&tmp, value, pool);
> + qval = svn_string_create (tmp->data, pool);

Urk. You're making another copy of that string, simply to transform it
into an svn_string_t structure. Icky. (ooh, and it gets worse...)

Ideally, qval would reside on the stack, and you could:

  qval.data = tmp->data;
  qval.len = tmp->len;

Obviously, that will change the other branch, but I imagine you can figure
out how to do that :-)

Hmm. Now that I pulled up the file to really look at the context, I'd
recommend changing qval to a 'const char *'. You can then do:

  qval = tmp->data;

and in the other branch:

  qval = svn_base64_encode_string(value, pool)->data;

Then just write out "qval" rather than "qval->data".

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Nov 12 01:24:18 2003

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