On Mon, Sep 11, 2006 at 09:52:54PM +0200, Juliusz Chroboczek wrote: > >> If you understand va_* -- could you please help me with fixing the > >> second definition of vsprintf_a, which has the same issue, but which I > >> don't know how to fix? It doesn't bite GNU/Linux systems, where the > >> first definition is used. > > > If you need to repeatedly use a given va_list, use va_copy(). See its > > manpage for the correct usage. > > As far as I can tell, it won't work in that case. I'm not using > va_start in that function.
You don't need to. You do need to do a va_end() after a va_copy()
though. So it's like this:
void a(char *fmt, ...) {
va_list ap;
va_start(ap, foo);
b(fmt, ap);
va_end();
}
void b(char *fmt, va_list ap) {
va_list ap2;
va_copy(ap2, ap);
vprintf(fmt, ap);
vprintf(fmt, ap2);
va_end(ap2);
}
--
Met vriendelijke groet / with kind regards,
Guus Sliepen <[EMAIL PROTECTED]>
signature.asc
Description: Digital signature

