From 467d7bb64eb8e77304fc6c91f612ec7b8036e475 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Thu, 5 Apr 2012 10:13:24 +0300 Subject: Implement missing xkb_state_ref and add return value xkb_state_ref was missing. Also modify the _ref functions to return the object instead of being void. This is a useful idiom: struct my_object my_object_new(struct xkb_state *state) { [...] my_object->state = xkb_state_ref(state); [...] } Essentially "taking" a reference, such that you don't forget to increment it and it's one line less (see example in our own code). A case could also be made for _unref to return the object or NULL, but this is quite uncommon. Signed-off-by: Ran Benita [daniels: Updated for xkb_keymap changes.] --- include/xkbcommon/xkbcommon.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/xkbcommon/xkbcommon.h b/include/xkbcommon/xkbcommon.h index 45e98e4..1391437 100644 --- a/include/xkbcommon/xkbcommon.h +++ b/include/xkbcommon/xkbcommon.h @@ -247,7 +247,7 @@ xkb_context_include_path_get(struct xkb_context *context, unsigned int index); /** * Takes a new reference on an XKB context. */ -_X_EXPORT void +_X_EXPORT struct xkb_context * xkb_context_ref(struct xkb_context *context); /** @@ -315,7 +315,7 @@ xkb_map_new_from_string(struct xkb_context *context, /** * Takes a new reference on a keymap. */ -_X_EXPORT extern void +_X_EXPORT extern struct xkb_keymap * xkb_map_ref(struct xkb_keymap *xkb); /** @@ -412,9 +412,9 @@ _X_EXPORT struct xkb_state * xkb_state_new(struct xkb_keymap *xkb); /** - * Adds a reference to a state object, so it will not be freed until unref. + * Takes a new reference on a state object. */ -_X_EXPORT void +_X_EXPORT struct xkb_state * xkb_state_ref(struct xkb_state *state); /** -- cgit v1.2.1