forked from len0rd/rockbox
buflib: Check the validity of of handles passed to buflib_get_data() in DEBUG builds.
Change-Id: Ic274bfb4a8e1a1a10f9a54186b9173dbc0faa4c8
This commit is contained in:
parent
d608d2203a
commit
d66346789c
6 changed files with 326 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue