[libc-commits] [PATCH] D84469: [libc] Adds implementation for memrchr.

Chris Gyurgyik via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Jul 23 17:19:19 PDT 2020


cgyurgyik marked 3 inline comments as done.
cgyurgyik added inline comments.


================
Comment at: libc/src/string/memrchr.cpp:18
+  const unsigned char ch = c;
+  while (--n) {
+    if (str[n] == ch)
----------------
cgyurgyik wrote:
> lntue wrote:
> > I think this will be a trouble if n == 0 because n is unsigned.
> You're right. Good catch, thanks.
Fixed, and added a test where size is 0.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84469/new/

https://reviews.llvm.org/D84469





More information about the libc-commits mailing list