summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-12-20 18:10:44 -0500
committerWilliam Wilgus <wilgus.william@gmail.com>2022-12-20 18:10:44 -0500
commit2b4a4070c99439898e22c9c9da2c21877d18a367 (patch)
tree95f977d3c866d9c37c9b867971021df6c07d844e
parent18ec1a2aa6f0acc87135569eaa64c11f30648d65 (diff)
downloadrockbox-2b4a4070c99439898e22c9c9da2c21877d18a367.tar.gz
rockbox-2b4a4070c99439898e22c9c9da2c21877d18a367.zip
buflib.c strip path from alloc name
Change-Id: I6a0f1cc9037fcbe0245d94b4c77ba4ec08378434
-rw-r--r--firmware/buflib.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/firmware/buflib.c b/firmware/buflib.c
index 2ce9cc344c..d9f82f8854 100644
--- a/firmware/buflib.c
+++ b/firmware/buflib.c
@@ -35,6 +35,7 @@
35#include "panic.h" 35#include "panic.h"
36#include "crc32.h" 36#include "crc32.h"
37#include "system.h" /* for ALIGN_*() */ 37#include "system.h" /* for ALIGN_*() */
38#include "pathfuncs.h" /* path_basename() */
38 39
39/* The main goal of this design is fast fetching of the pointer for a handle. 40/* The main goal of this design is fast fetching of the pointer for a handle.
40 * For that reason, the handles are stored in a table at the end of the buffer 41 * For that reason, the handles are stored in a table at the end of the buffer
@@ -658,6 +659,9 @@ int
658buflib_alloc_ex(struct buflib_context *ctx, size_t size, const char *name, 659buflib_alloc_ex(struct buflib_context *ctx, size_t size, const char *name,
659 struct buflib_callbacks *ops) 660 struct buflib_callbacks *ops)
660{ 661{
662 if (name) /* if name is a path strip everything but the filename */
663 path_basename(name, &name);
664
661 union buflib_data *handle, *block; 665 union buflib_data *handle, *block;
662 size_t name_len = name ? B_ALIGN_UP(strlen(name)+1) : 0; 666 size_t name_len = name ? B_ALIGN_UP(strlen(name)+1) : 0;
663 bool last; 667 bool last;