----- Original Message -----
> On Tue, Jan 25, 2011 at 07:17:25PM +0100, Marc-André Lureau wrote:
> > diff --git a/common/mem.c b/common/mem.c
> > index b0a7eb1..4db8a2c 100644
> > --- a/common/mem.c
> > +++ b/common/mem.c
> > @@ -71,6 +71,10 @@ void *spice_memdup(const void *mem, size_t
> > n_bytes)
> >  {
> >      void *copy;
> >
> > + if (mem == NULL) {
> > + return NULL;
> > + }
> > +
> 
> I'd rather have an ASSERT(n_bytes == 0) if we do this change so that
> we
> don't allow memdup'ing pointers that are not expected to be NULL.

Sigh.. i would prefer to avoid ASSERT, and instead use return_val_if_fail() or 
so.

That's probably why I didn't add it in the first place.

> Do you remember why you needed this? Wasn't it possible to fix the
> caller
> to not pass NULL?

I can't remember, it probably made some code easier to read, and it follows 
glib way.
http://developer.gnome.org/glib/unstable/glib-Memory-Allocation.html#g-memdup

-- 
Marc-André Lureau
_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to