Re: [gupnp] [PATCH] Free the array allocated by xmlGetNsList()



On Wed, 2010-05-19 at 20:19 +0300, Zeeshan Ali (Khattak) wrote:
> On Wed, May 19, 2010 at 7:26 PM, Sven Neumann <s neumann raumfeld com> wrote:
> > apart from the memory leak, which is fixed by the patch that I just
> > submitted, it appears to be somewhat inefficient to parse the list of
> > namespaces for each object that is added.
> >
> > So what I suggest is that GUPnPDIDLLiteWriter passes the two needed
> > namespace references to the GUPnPDIDLLiteObject on object creation
> > instead of having each object looking them up in the array of
> > namespaces. Would you accept a patch that does this?
> 
>   If you pass it the same way the doc/node is passed, sure! :)

Turns out to be difficult to implement this without changing public API.
We would have to add more parameters to
gupnp_didl_lite_object_new_from_xml().

Perhaps the cleanest way to do this would be to add generic API to
GUPnPXMLDoc that allows to register namespaces and API to look them up
by their associated URN. That would potentially allow to clean up
namespace handling all over the place. But I am not sure if such a
change would be welcomed or if GUPnPXMLDoc is supposed to be nothing but
a wrapper to allow xmlDoc to be ref-counted.

We could also use g_object_get() and g_object_set() in gupnp-av to
attach the namespaces to the GUPnPXMLDoc object using their URN. That
way we wouldn't have to introduce new public API and it would still be a
relately clean internal API.

What do you think? Any other ideas?


Sven


--
To unsubscribe send a mail to gupnp+unsubscribe\@o-hand.com



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