mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
xmalloc: add xmemdup() and use to replace some uses of xmalloc+memcpy
This commit is contained in:
parent
853be450bb
commit
e8b04e0e2c
4 changed files with 14 additions and 18 deletions
|
|
@ -18,6 +18,12 @@ char *xasprintf(const char *format, ...) PRINTF(1) XMALLOC;
|
|||
char *xvasprintf(const char *format, va_list va) VPRINTF(1) XMALLOC;
|
||||
char32_t *xc32dup(const char32_t *str) XSTRDUP;
|
||||
|
||||
static inline void *
|
||||
xmemdup(const void *ptr, size_t size)
|
||||
{
|
||||
return memcpy(xmalloc(size), ptr, size);
|
||||
}
|
||||
|
||||
static inline char *
|
||||
xstrjoin(const char *s1, const char *s2)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue