diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-06-19 12:08:10 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-06-20 14:09:46 -0400 |
commit | 9ceb2b27577f1be3f30edb40a45117066fc78c51 (patch) | |
tree | bc85b811b9ec25c83e3918f8cdc8c046516af953 /src/bfstd.c | |
parent | e062158e0a855cddcd3838fef415a7531929686b (diff) | |
download | bfs-9ceb2b27577f1be3f30edb40a45117066fc78c51.tar.xz |
bfstd: New xmemdup() function
Diffstat (limited to 'src/bfstd.c')
-rw-r--r-- | src/bfstd.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bfstd.c b/src/bfstd.c index cfff426..856c76c 100644 --- a/src/bfstd.c +++ b/src/bfstd.c @@ -243,6 +243,14 @@ static char type_char(mode_t mode) { return '?'; } +void *xmemdup(const void *src, size_t size) { + void *ret = malloc(size); + if (ret) { + memcpy(ret, src, size); + } + return ret; +} + void xstrmode(mode_t mode, char str[11]) { strcpy(str, "----------"); |