hiraditya added inline comments.

================
Comment at: libcxx/include/__string:549
+    // Stop short when source is smaller than pattern.
+    ptrdiff_t __len2 = __last2 - __first2;
+    if (__len2 == 0)
----------------
mclow.lists wrote:
> Is there a reason that you calculate the end pointer(s) from `first + len` in 
> the calling function, then recover the length here?
> 
> Also, `__len1` and `__len2` should be const.
Recovering length here is only making the interface uniform, I don't have any 
specific reason for that. This function is going to be inlined anyways. It 
started this way because I copied the interface from std::__search in the 
header file algorithm.



len2 can be a const, since len1 changes in the loop, for this to make const I 
would have to introduce another variable. I'll update the patch.



https://reviews.llvm.org/D27068



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to