[xslt] Re: libxml2-2.5.7 and libxslt-1.0.30 -- bugs and patches

On Fri, 13 Jun 2003, Daniel Veillard wrote:

>   explaining the reasons of the changes would help too ...

Sorry, I forgot that. Since I saw the compiler warnings, the reason was
obvious to me. And I didn't remember that some of them depend on -O2.

> > NB: I really think xmlFree should be prototyped differently such that it
> > accepts a `const char *' argument without warning, e.g.
> > 	void xmlFree(void *);
> > or similar.
>    xmlFreeFunc xmlFree = (xmlFreeFunc) free;
>    typedef void (*xmlFreeFunc)(void *mem);

Maybe I was wrong, and the only thing needed was changing
	static const char *output = NULL;
	static char *output = NULL;

> > @@ -7853,7 +7853,7 @@
> >  	}
> >  	xmlRelaxNGFreeStates(ctxt, ctxt->states);
> >  	ctxt->states = NULL;
> > -	if ((ret == 0) && (tmp == -1))
> > +	if (tmp == -1)
>   I see no justification for that, what compiler warning led you to change
> that code ? I see no warning with
>    gcc -DHAVE_CONFIG_H -I. -I. -I. -I./include -I./include -D_REENTRANT -g -O -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls
>   Looks to me as change in the semantic, of the code, why ?

With -O2 you will see that `res' is possibly used uninitialized, and indeed
all statemants that assign a value to res are inside if-clauses! Maybe my
patch changes the semantics, but something has to be done here. 'gcc -O2' is
quite good in giving hints to possibly uninitialized vars and quite often is

Peter Breitenlohner <peb@mppmu.mpg.de>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]