summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2012-04-05 10:13:24 +0300
committerDaniel Stone <daniel@fooishbar.org>2012-04-09 13:57:36 +0100
commit467d7bb64eb8e77304fc6c91f612ec7b8036e475 (patch)
tree4916e6385262a350e50a1d835cc3004c6c6e6cd8 /include
parentb08629f92b20a470cfd11ad03fe4d9085a2612d2 (diff)
downloadlibxkbcommon-467d7bb64eb8e77304fc6c91f612ec7b8036e475.tar.gz
libxkbcommon-467d7bb64eb8e77304fc6c91f612ec7b8036e475.tar.bz2
libxkbcommon-467d7bb64eb8e77304fc6c91f612ec7b8036e475.zip
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 <ran234@gmail.com> [daniels: Updated for xkb_keymap changes.]
Diffstat (limited to 'include')
-rw-r--r--include/xkbcommon/xkbcommon.h8
1 files changed, 4 insertions, 4 deletions
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);
/**