From: Horst von Brand Date: Tue, 20 Sep 2005 19:55:32 GMT Subject: Re: [PATCH] Make the git-fsck-objects diagnostics more useful Message-ID: <200509201955.j8KJtWAr003157@laptop11.inf.utfsm.cl> In-Reply-To: Petr Baudis wrote: > Actually report what exactly is wrong with the object, instead of an > ambiguous 'bad sha1 file' or such. In places where we already do, unify > the format and clean the messages up. > > Signed-off-by: Petr Baudis > > --- > commit ff0b3368b45a07ac080574eb721a607892413b99 > tree c5e730edddb7679bee63a7d76fb088a7378a9d8b > parent 12913234050c07785b7fc5929e4c8b5f80606609 > author Petr Baudis Tue, 20 Sep 2005 20:54:33 +0200 > committer Petr Baudis Tue, 20 Sep 2005 20:54:33 +0200 > > fsck-objects.c | 82 +++++++++++++++++++++++++++++++++----------------------- > 1 files changed, 48 insertions(+), 34 deletions(-) > > diff --git a/fsck-objects.c b/fsck-objects.c > --- a/fsck-objects.c > +++ b/fsck-objects.c > @@ -20,6 +20,35 @@ static int check_strict = 0; > static int keep_cache_objects = 0; > static unsigned char head_sha1[20]; > > + > +static void objreport(struct object *obj, const char *severity, > + const char *err, va_list params) > +{ > + fprintf(stderr, "%s in %s %s: ", > + severity, obj->type, sha1_to_hex(obj->sha1)); > + vfprintf(stderr, err, params); > + fputs("\n", stderr); > +} Is this legal? I am under the impression you have to call va_start()/va_end() always, even if you just pass the va_list down. The comp.lang.c FAQ agrees with me here... it should be: static void objreport(struct object *obj, const char *severity, const char *err, ...) { va_list params; fprintf(stderr, "%s in %s %s: ", severity, obj->type, sha1_to_hex(obj->sha1)); va_start(params, err); vfprintf(stderr, err, params); va_end(params); fputs("\n", stderr); } [Yes, I know. "We all are using gcc and glibc on Linux". But anyway.] -- Dr. Horst H. von Brand User #22616 counter.li.org Departamento de Informatica Fono: +56 32 654431 Universidad Tecnica Federico Santa Maria +56 32 654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513