Re: [Openocd-development] [PATCH] improve alloc_vprintf

2009-11-24 Thread Zach Welch
On Tue, 2009-11-24 at 21:24 +0100, Andreas Fritiofson wrote: > The previous implementation was unnecessarily complex. Get rid of the loops, > let vsnprintf() tell us directly how much storage we need and allocate that. A > second pass writes the actual string. Also add a va_end() that was missing.

[Openocd-development] [PATCH] improve alloc_vprintf

2009-11-24 Thread Andreas Fritiofson
The previous implementation was unnecessarily complex. Get rid of the loops, let vsnprintf() tell us directly how much storage we need and allocate that. A second pass writes the actual string. Also add a va_end() that was missing. This should be much faster for large strings and less wasteful for

Re: [Openocd-development] [PATCH] improve alloc_vprintf

2009-11-23 Thread Zach Welch
Looks great, but one minor comment below On Tue, 2009-11-24 at 00:37 +0100, Andreas Fritiofson wrote: > The previous implementation was unnecessarily complex. Get rid of the loops, > let vsnprintf() tell us directly how much storage we need and allocate that. A > second pass writes the actual

[Openocd-development] [PATCH] improve alloc_vprintf

2009-11-23 Thread Andreas Fritiofson
The previous implementation was unnecessarily complex. Get rid of the loops, let vsnprintf() tell us directly how much storage we need and allocate that. A second pass writes the actual string. Also add a va_end() that was missing. This should be much faster for large strings and less wasteful for