strcasestr: avoid quadratic time consumption

2007-02-11 Thread Bruno Haible
Like c_strstr, here is a patch for strcasestr that avoids quadratic asymptotic complexity. One could consider introducing new modules 'strstr-linear' and 'strcasestr-linear' which override the system's strstr() or strcasestr() functions if they have a quadratic worst-case time consumption. But sin

c-strcasestr: avoid quadratic time consumption

2007-02-11 Thread Bruno Haible
Like c_strstr, here is a patch for c_strcasestr that avoids quadratic asymptotic complexity. 2007-02-11 Bruno Haible <[EMAIL PROTECTED]> Ensure O(n) worst-case complexity of c_strcasestr. * lib/c-strcasestr.c: Include stdbool.h, string.h. (knuth_morris_pratt): New functi