History log of /haiku/src/system/libroot/posix/string/strndup.cpp
Revision Date Author Comments
# 522c74f3 18-Sep-2021 Augustin Cavalier <waddlesplash@gmail.com>

libroot: Use strnlen in strndup.

This is both more correct, as we need to not read past the 'size'
position of the passed pointer, and much faster, in the case where
the passed pointer is into some very large block of memory.

This provides an unbelievable speedup to a microbenchmark posted on IRC
that makes heavy use of this function in tandem with some rather
large allocations. (Some variants of it go from multiple minutes
to under a second!)


# 18f27bf1 18-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* Added POSIX function strndup(), closing ticket #3309.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28939 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 18f27bf19f272f703b8be28c4ceeff837fb6c0ae 18-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* Added POSIX function strndup(), closing ticket #3309.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28939 a95241bf-73f2-0310-859d-f6bbb57e9c96