buflib.c strip path from alloc name
Change-Id: I6a0f1cc9037fcbe0245d94b4c77ba4ec08378434
This commit is contained in:
parent
18ec1a2aa6
commit
2b4a4070c9
1 changed files with 4 additions and 0 deletions
|
@ -35,6 +35,7 @@
|
||||||
#include "panic.h"
|
#include "panic.h"
|
||||||
#include "crc32.h"
|
#include "crc32.h"
|
||||||
#include "system.h" /* for ALIGN_*() */
|
#include "system.h" /* for ALIGN_*() */
|
||||||
|
#include "pathfuncs.h" /* path_basename() */
|
||||||
|
|
||||||
/* The main goal of this design is fast fetching of the pointer for a handle.
|
/* The main goal of this design is fast fetching of the pointer for a handle.
|
||||||
* For that reason, the handles are stored in a table at the end of the buffer
|
* For that reason, the handles are stored in a table at the end of the buffer
|
||||||
|
@ -658,6 +659,9 @@ int
|
||||||
buflib_alloc_ex(struct buflib_context *ctx, size_t size, const char *name,
|
buflib_alloc_ex(struct buflib_context *ctx, size_t size, const char *name,
|
||||||
struct buflib_callbacks *ops)
|
struct buflib_callbacks *ops)
|
||||||
{
|
{
|
||||||
|
if (name) /* if name is a path strip everything but the filename */
|
||||||
|
path_basename(name, &name);
|
||||||
|
|
||||||
union buflib_data *handle, *block;
|
union buflib_data *handle, *block;
|
||||||
size_t name_len = name ? B_ALIGN_UP(strlen(name)+1) : 0;
|
size_t name_len = name ? B_ALIGN_UP(strlen(name)+1) : 0;
|
||||||
bool last;
|
bool last;
|
||||||
|
|
Loading…
Reference in a new issue