mirror of
https://git.proxmox.com/git/efi-boot-shim
synced 2025-08-15 12:12:27 +00:00
add an ascii strndup() implementation.
Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
parent
b0a2ea0caa
commit
cf7260d432
@ -42,6 +42,24 @@ strcata(CHAR8 *dest, const CHAR8 *src)
|
||||
return dest;
|
||||
}
|
||||
|
||||
static inline
|
||||
__attribute__((unused))
|
||||
CHAR8 *
|
||||
strndupa(const CHAR8 * const src, const UINTN srcmax)
|
||||
{
|
||||
UINTN len;
|
||||
CHAR8 *news = NULL;
|
||||
|
||||
if (!src || !srcmax)
|
||||
return news;
|
||||
|
||||
len = strnlena(src, srcmax);
|
||||
news = AllocateZeroPool(len);
|
||||
if (news)
|
||||
strncpya(news, src, len);
|
||||
return news;
|
||||
}
|
||||
|
||||
static inline
|
||||
__attribute__((unused))
|
||||
CHAR8 *
|
||||
|
Loading…
Reference in New Issue
Block a user