summaryrefslogtreecommitdiff
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.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,
237 * 237 *
238 * Returns: The start pointer of the allocation 238 * Returns: The start pointer of the allocation
239 */ 239 */
240static inline void* buflib_get_data(struct buflib_context *context, int handle) 240#ifdef DEBUG
241void* buflib_get_data(struct buflib_context *ctx, int handle);
242#else
243static inline void* buflib_get_data(struct buflib_context *ctx, int handle)
241{ 244{
242 return (void*)(context->handle_table[-handle].alloc); 245 return (void*)(ctx->handle_table[-handle].alloc);
243} 246}
247#endif
244 248
245/** 249/**
246 * Shrink the memory allocation associated with the given handle 250 * Shrink the memory allocation associated with the given handle