Name struct owning field `owner`
In Weston, we have several struct
s whose lifetime is strictly controlled by the associated wl_resource
: the struct
cannot out-live the resource, without exception.
I would propose to rename that struct wl_resource *
field to owner
to underline this invariant. A struct
cannot exist with owner == NULL
. It implies that owner
is a back-pointer to an object with its own life time.
I think one can find these by grepping for wl_resource_create
and inspecting the destructor recorded with wl_resource_set_implementation()
. For example, struct weston_surface
is not one, because it can exist without its wl_resource
.
I feel we should start using this convention at least with new code, and apply it to more owners than just wl_resource
s.