[libc-commits] [PATCH] D82376: [libc] Add strdup implementation.
Chris Gyurgyik via Phabricator via libc-commits
libc-commits at lists.llvm.org
Tue Jun 23 09:37:32 PDT 2020
cgyurgyik marked an inline comment as done.
cgyurgyik added inline comments.
================
Comment at: libc/src/string/strdup.cpp:18
+ const size_t length = __llvm_libc::strlen(s) + 1;
+ char *duplicate = new char[length];
+ if (!duplicate)
----------------
abrachet wrote:
> We can't use `new` unfortunately. Even if `operator new` was a completely free standing allocator which didn't depend on libc functions we may not provide, `operator new[]` is not guaranteed to be free-able by `free`. This function has to wait for `malloc`
Ok thanks. I'll close this for now then.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82376/new/
https://reviews.llvm.org/D82376
More information about the libc-commits
mailing list