diff --git a/include/str.h b/include/str.h index ea03ee3..baa260e 100644 --- a/include/str.h +++ b/include/str.h @@ -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 *