Fast string search

Leonid Volnitsky leonid at volnitsky.com
Wed Dec 15 13:26:32 PST 2010


Thanks for bug report!  Code is very new.
Bug manifests itself when substring is in 0 position.
Fix:

diff --git a/volnitsky.h b/volnitsky.h
index a7dbc1f..62d686d 100644
-- a/volnitsky.h
+++ b/volnitsky.h
@@ -26,7 +26,7 @@ const char*     volnitsky(const char*  S,  const char* Se,
const char* SS,  con
         // step through text
-        for (const char* p = S+step;   p <= Se-W_size;  p+=step)  {
+        for (const char* p = S+step-W_size;   p <= Se-W_size;  p+=step)  {


More information about the Digitalmars-d mailing list