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

Re: [PATCH] svndumpfilter's use of %n

From: Malcolm Rowe <malcolm-svn-dev_at_farside.org.uk>
Date: 2007-02-24 19:01:48 CET

On Sat, Feb 24, 2007 at 09:22:59AM -0700, D.J. Heap wrote:
> Are there any objections to changing svndumpfilter's use of sprintf
> with %n over to apr_snprintf with %n?
>

I had to look up %n to find out what it did. It might be better to do
something like the following:

> - sprintf(buf, "%d%n", namelen, &bytes_used);
> - svn_stringbuf_appendbytes(*strbuf, buf, bytes_used);
> + sprintf(buf, "%d", namelen);
> + svn_stringbuf_appendbytes(*strbuf, buf, strlen(buf));
> svn_stringbuf_appendbytes(*strbuf, "\n", 1);
>

Slightly less efficient, but a whole lot clearer.

Regards,
Malcolm

  • application/pgp-signature attachment: stored
Received on Sat Feb 24 19:02:04 2007

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.