Define strnlen when it is not in libc

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 10:55:46 PST 2016


> On 2016-Nov-24, at 11:10, Joerg Sonnenberger via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> On Thu, Nov 24, 2016 at 02:06:55PM -0500, Chi-Hua Chen via llvm-commits wrote:
>> Some older platforms, e.g. Mac 10.6.8, do not have strnlen. Define one
>> in Support when necessary.
> 
> Personally, I'd prefer to just avoid it in first place. It is not really
> much simpler than just using memchr.

`StringRef(...).find('\0')` seems cleaner.

> 
> Joerg
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list