Re: [evolution-patches] Fixes for compiler warnings about signedness



On Sat, 2006-01-07 at 15:34 +0100, Philip Van Hoof wrote:

> xmlDocPtr = /* etc */
> xmlNodePtr node = /* etc */
> 
> gchar *name = g_strdup ("id");
> const xmlChar *xatt = (const xmlChar*)name;
> xmlChar *xprop = xmlGetProp (node, xatt);
> gchar *prop = g_strdup ((const gchar*)xprop);
> xmlFree (xprop); /* but don't free xatt */
> 
> xmlFreeNode (node);  /* and/or */
> xmlFreeDoc (doc); /* etc */
> 
> Whether or not the strdup the xprop to prop might or might not be a
> necessity. It might depend on how strictly you want to separate GLib
> from libxml2. Short version: it doesn't really matter (this way means
> introducing an extra string duplication followed by a free of the
> original).

Ah, by the way, a very recent case of this strdupping and xmlFree'ing is
the patch created by Tor:

[evolution-patches] Freeing a xmlGetProp() return value with g_free()



-- 
Philip Van Hoof, software developer at x-tend 
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
work: vanhoof at x-tend dot be 
http://www.pvanhoof.be - http://www.x-tend.be




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