https://bugs.kde.org/show_bug.cgi?id=454040

Mark Wielaard <m...@klomp.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |m...@klomp.org

--- Comment #2 from Mark Wielaard <m...@klomp.org> ---
Looks good and fixes the issue for me.

+      /* If the needle is the empty string, match immediately. */ \
+      if (nlen == 0) return CONST_CAST(void *,h); \
+      \
+      HChar n0 = n[0]; \
+      \
+      for (; hlen >= nlen; hlen--, h++) { \
+         const HChar hh = *h; \
+         if (hh != n0) continue; \
+         \
+         UWord i; \
+         for (i = 0; i < nlen; i++) { \
+            if (n[i] != h[i]) \
+               break; \
+         } \
+         if (i == nlen) \
+           return CONST_CAST(HChar *,h); \

I think the for loop could/should be from i = 1. needle being zero sized (nlen
== 0) and n[0] == h[0] (hh != n0) has already been checked above.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to