From 702d808b285931850e66900bd6c7c7319ae6d73c Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Thu, 10 Apr 2014 20:09:34 +0300 Subject: Make it possible to set and get userdata pointers. --- lib/item.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'lib/item.c') diff --git a/lib/item.c b/lib/item.c index e6ccc7a..f2a879a 100644 --- a/lib/item.c +++ b/lib/item.c @@ -35,6 +35,31 @@ void bmItemFree(bmItem *item) free(item); } +/** + * Set userdata pointer to bmItem instance. + * Userdata will be carried unmodified by the instance. + * + * @param item bmItem instance where to set userdata pointer. + * @param userdata Pointer to userdata. + */ +void bmItemSetUserdata(bmItem *item, void *userdata) +{ + assert(item); + item->userdata = userdata; +} + +/** + * Get userdata pointer from bmItem instance. + * + * @param item bmItem instance which userdata pointer to get. + * @return Pointer for unmodified userdata. + */ +void* bmItemGetUserdata(bmItem *item) +{ + assert(item); + return item->userdata; +} + /** * Set text to bmItem instance. * -- cgit v1.2.3-70-g09d2