On Thu, Sep 20, 2007 at 04:27:31AM +0000, Junio C Hamano wrote:
quoted text > Pierre Habouzit <madcoder@debian.org> writes:
>=20
> > * drop nfasprintf.
> > * move nfvasprintf into imap-send.c back, and let it work on a 8k buffe=
r,
quoted text > > and die() in case of overflow. It should be enough for imap commands,=
if
quoted text > > someone cares about imap-send, he's welcomed to fix it properly.
> > * replace nfvasprintf use in merge-recursive with a copy of the strbuf_=
addf
quoted text > > logic, it's one place, we'll live with it.
> > To ease the change, output_buffer string list is replaced with a strb=
uf ;)
quoted text >=20
> While I'd agree with all of the above,
>=20
> > * rework trace.c API's so that only one of the trace functions takes a
> > vararg. It's used to format strerror()s and git command names, it sho=
uld
quoted text > > never be more than a few octets long, let it work on a 8k static buff=
er
quoted text > > with vsnprintf or die loudly.
>=20
> and I'd agree with this in principle, there is a minor nit with
> the implementation and use in trace.c. E.g.
>=20
> > diff --git a/exec_cmd.c b/exec_cmd.c
> > index 9b74ed2..c0f954e 100644
> > --- a/exec_cmd.c
> > +++ b/exec_cmd.c
> > @@ -97,7 +97,8 @@ int execv_git_cmd(const char **argv)
> > tmp =3D argv[0];
> > argv[0] =3D git_command;
> > =20
> > - trace_argv_printf(argv, -1, "trace: exec:");
> > + trace_printf("trace: exec:");
> > + trace_argv(argv, -1);
>=20
> This used to be a single call into trace.c which would format a
> single string to write(2) out. Now these two messages go
> through separate write(2) and can be broken up. I think the
> atomicity of the log/trace message was the primary reason the
> original had such a strange calling convention.
Okay, given that the formats (as you can see) are always very short,
and that it will always fit in a big enough static buffer, I'll
reinstate this and use a vsnprintf twice then.
--=20
=C2=B7O=C2=B7 Pierre Habouzit
=C2=B7=C2=B7O madcoder@debia=
n.org
OOO
http://www.madism.org