[libc-commits] [PATCH] D83956: [libc] Add strstr implementation.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Jul 20 10:00:44 PDT 2020


sivachandra added inline comments.


================
Comment at: libc/src/string/strstr.cpp:17
+
+// TODO: This is a simple brute force implementation that uses strlen.
+// This can (and will) be improved upon using well known string matching
----------------
You shouldn't need `strlen` even for a brute force implementation unless a future update will call `strlen`. Even then, doesn't seem like using `strlen` should be used until we really need it.


================
Comment at: libc/src/string/strstr.cpp:25
+    return nullptr;
+  size_t j;
+  for (size_t i = 0; i <= hsize - nsize; ++i) {
----------------
This declaration can be moved within the outer `for` loop?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83956





More information about the libc-commits mailing list