summaryrefslogtreecommitdiffstats
path: root/firmware/include
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-01-28 15:33:40 +0100
committerThomas Martitz <kugel@rockbox.org>2014-02-02 16:59:29 +0100
commitd66346789ccdf685a6720a739b88f194f56a60e2 (patch)
treeb9c69c8801c787adbc7ec3f46f985c09599e565e /firmware/include
parentd608d2203aff93d6d68e7afbac7767cf95c03b8b (diff)
downloadrockbox-d66346789ccdf685a6720a739b88f194f56a60e2.tar.gz
rockbox-d66346789ccdf685a6720a739b88f194f56a60e2.tar.bz2
rockbox-d66346789ccdf685a6720a739b88f194f56a60e2.zip
buflib: Check the validity of of handles passed to buflib_get_data() in DEBUG builds.
Change-Id: Ic274bfb4a8e1a1a10f9a54186b9173dbc0faa4c8
Diffstat (limited to 'firmware/include')
-rw-r--r--firmware/include/buflib.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/firmware/include/buflib.h b/firmware/include/buflib.h
index 171ab5bcd7..30484431f8 100644
--- a/firmware/include/buflib.h
+++ b/firmware/include/buflib.h
@@ -237,10 +237,14 @@ int buflib_alloc_maximum(struct buflib_context* ctx, const char* name,
*
* Returns: The start pointer of the allocation
*/
-static inline void* buflib_get_data(struct buflib_context *context, int handle)
+#ifdef DEBUG
+void* buflib_get_data(struct buflib_context *ctx, int handle);
+#else
+static inline void* buflib_get_data(struct buflib_context *ctx, int handle)
{
- return (void*)(context->handle_table[-handle].alloc);
+ return (void*)(ctx->handle_table[-handle].alloc);
}
+#endif
/**
* Shrink the memory allocation associated with the given handle