Re: warnings important?



Michael Harnois wrote:
> 
>     > I'm not sure about this.  I expect `XmHTMLfuncs.h' to define an
>     > useful `strdup', but why does it define it in the first place?
>     > I don't think this warning needs alarm us too much, though.
> 
> Here is the relevant code from the include file:
> 
I guess this was coming from the string2.h include. XmHTML (motif
version) can redefine strdup in three different ways, all depending on
the compilation flags. I don't know exactly what's the case in
gtk-xmhtml, but's here what's being done for the motif version:

clean build: define strdup to XtNewString (strdup with error checking);
debug build: define strdup to some internal function, with error
checking;
dmalloc build: dmalloc provides it's own macro.

If I'm not mistaking, gtk-xhmtl uses a wrapper function (called
g_strdup_wrapper) for normal builds since (last time I checked), gdk
doesn't provide a g_strdup by itself as it does for g_malloc and
friends.

In the end, the macro resolves into a function that either calls strdup
or does something similar, but always with error checking.

In the end, what you loose is the inlined function, and what you get
back is a program checks *every* strdup and tells you what went wrong
before exiting instead of trashing everything without a warning when
strdup fails. If you don't like this, you can simply remove the strdup
define(s), but be warned that XmHTML assumes that when strdup returns,
it always assumes that the returned memory is valid.

Cheers,
Koen D'Hondt.
-- 
XmHTML author and maintainer
ripley@xs4all.nl                          http://www.xs4all.nl/~ripley



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