Re: GNOME CVS: libbonobo michael
- From: Havoc Pennington <hp redhat com>
- To: Michael Meeks <michael ximian com>
- Cc: jacob berkman <jacob ximian com>, <gnome-components-list gnome org>
- Subject: Re: GNOME CVS: libbonobo michael
- Date: 31 Oct 2001 18:11:49 -0500
Michael Meeks <michael ximian com> writes:
> 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.
I usually write:
bonobo_control_set_pb (control, pb)
{
if (pb)
bonobo_object_ref (pb);
if (control->pb)
bonobo_object_unref (control->pb);
control->pb = pb;
}
Which is just as short, and clarifies that either control->pb or pb
could be NULL.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]