[libc-commits] [PATCH] D110581: [libc][NFC] Make strchr and strrchr more consistent

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Sep 27 22:26:43 PDT 2021


sivachandra added inline comments.


================
Comment at: libc/src/string/strrchr.cpp:16
 LLVM_LIBC_FUNCTION(char *, strrchr, (const char *src, int c)) {
-  const char ch = c;
+  const unsigned char ch = c;
   char *last_occurrence = nullptr;
----------------
Same here - keep this `char` instead of `unsigned char`. If it is `unsigned char`, then you end up comparing singed and unsigned values on line 19.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110581



More information about the libc-commits mailing list