From d66346789ccdf685a6720a739b88f194f56a60e2 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Tue, 28 Jan 2014 15:33:40 +0100 Subject: buflib: Check the validity of of handles passed to buflib_get_data() in DEBUG builds. Change-Id: Ic274bfb4a8e1a1a10f9a54186b9173dbc0faa4c8 --- firmware/include/buflib.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'firmware/include') 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 -- cgit v1.2.3