diff options
author | Thomas Martitz <kugel@rockbox.org> | 2014-02-02 14:43:45 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2014-02-02 19:40:38 +0100 |
commit | 4ce1deacfd4e5440cc82237ebc5fafbaeea64763 (patch) | |
tree | 7ff4664819704fd890d3e5ea95349c8500f9c4c7 /firmware/include | |
parent | d66346789ccdf685a6720a739b88f194f56a60e2 (diff) | |
download | rockbox-4ce1deacfd4e5440cc82237ebc5fafbaeea64763.tar.gz rockbox-4ce1deacfd4e5440cc82237ebc5fafbaeea64763.zip |
buflib: Properly support allocations without any name, to avoid wasting space
in micro-allocation scenarios.
Change-Id: I97a065bcfba8e0fda9b1670445e839e267c769c8
Diffstat (limited to 'firmware/include')
-rw-r--r-- | firmware/include/buflib.h | 8 | ||||
-rw-r--r-- | firmware/include/core_alloc.h | 7 |
2 files changed, 6 insertions, 9 deletions
diff --git a/firmware/include/buflib.h b/firmware/include/buflib.h index 30484431f8..e912429b1f 100644 --- a/firmware/include/buflib.h +++ b/firmware/include/buflib.h | |||
@@ -303,12 +303,14 @@ void buflib_buffer_in(struct buflib_context *ctx, int size); | |||
303 | /* debugging */ | 303 | /* debugging */ |
304 | 304 | ||
305 | /** | 305 | /** |
306 | * Returns the name, as given to core_alloc() and core_allloc_ex(), of the | 306 | * Returns the name, as given to buflib_alloc() and buflib_allloc_ex(), of the |
307 | * allocation associated with the given handle | 307 | * allocation associated with the given handle. As naming allocations |
308 | * is optional, there might be no name associated. | ||
308 | * | 309 | * |
309 | * handle: The handle indicating the allocation | 310 | * handle: The handle indicating the allocation |
310 | * | 311 | * |
311 | * Returns: A pointer to the string identifier of the allocation | 312 | * Returns: A pointer to the string identifier of the allocation, or NULL |
313 | * if none was specified with buflib_alloc_ex/(. | ||
312 | */ | 314 | */ |
313 | const char* buflib_get_name(struct buflib_context *ctx, int handle); | 315 | const char* buflib_get_name(struct buflib_context *ctx, int handle); |
314 | 316 | ||
diff --git a/firmware/include/core_alloc.h b/firmware/include/core_alloc.h index 095cb5da11..67fe99dfdc 100644 --- a/firmware/include/core_alloc.h +++ b/firmware/include/core_alloc.h | |||
@@ -17,6 +17,7 @@ bool core_shrink(int handle, void* new_start, size_t new_size); | |||
17 | int core_free(int handle); | 17 | int core_free(int handle); |
18 | size_t core_available(void); | 18 | size_t core_available(void); |
19 | size_t core_allocatable(void); | 19 | size_t core_allocatable(void); |
20 | const char* core_get_name(int handle); | ||
20 | #ifdef DEBUG | 21 | #ifdef DEBUG |
21 | void core_check_valid(void); | 22 | void core_check_valid(void); |
22 | #endif | 23 | #endif |
@@ -43,10 +44,4 @@ static inline void* core_get_data(int handle) | |||
43 | return buflib_get_data(&core_ctx, handle); | 44 | return buflib_get_data(&core_ctx, handle); |
44 | } | 45 | } |
45 | 46 | ||
46 | static inline const char* core_get_name(int handle) | ||
47 | { | ||
48 | extern struct buflib_context core_ctx; | ||
49 | return buflib_get_name(&core_ctx, handle); | ||
50 | } | ||
51 | |||
52 | #endif /* __CORE_ALLOC_H__ */ | 47 | #endif /* __CORE_ALLOC_H__ */ |