Re: GNOME CVS: libbonobo michael



On 31 Oct 2001, jacob berkman wrote:
> > * bonobo/bonobo-object.c (bonobo_object_ref): tolerate
> > NULL silently.
>
> what's the rationale for this?

        Mainly so you can have the same method set and unset a reference,
and not screw with the flow control in a way that causes errors:

        ie. not:

bonobo_control_set_pb (control, pb)
{
        if (control->pb == pb)
                return;

        if (control->pb)
                bonobo_object_unref (control->pb);

        if (pb)
                control->pb = bonobo_object_ref (pb);
        else
                control->pb = NULL;
}

        but;

bonobo_control_set_pb (control, pb)
{
        if (control->pb == pb)
                return;

        bonobo_object_unref (control->pb);
        control->pb = bonobo_object_ref (pb);
}

        Which is more lucid, and less prone to people forgetting the NULL
path to set the value to NULL.

        Regards,

                Michael.

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot




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