X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmbsstr.c;h=464fb7d6c90468678478c466c4bff8a5e7d0c135;hb=a425462f784164b73297d8992075fd9aebd65a94;hp=d44b4c3d4a943cf548e5a5ddc66a311c7ab117d5;hpb=b2e2010c7c902235b5efb5bd3c6529f61b093aa4;p=gnulib.git diff --git a/lib/mbsstr.c b/lib/mbsstr.c index d44b4c3d4..464fb7d6c 100644 --- a/lib/mbsstr.c +++ b/lib/mbsstr.c @@ -1,5 +1,5 @@ /* Searching in a string. - Copyright (C) 2005-2010 Free Software Foundation, Inc. + Copyright (C) 2005-2012 Free Software Foundation, Inc. Written by Bruno Haible , 2005. This program is free software: you can redistribute it and/or modify @@ -27,6 +27,7 @@ #include "mbuiter.h" /* Knuth-Morris-Pratt algorithm. */ +#define UNIT unsigned char #define CANON_ELEMENT(c) c #include "str-kmp.h" @@ -339,10 +340,12 @@ mbsstr (const char *haystack, const char *needle) if (needle_last_ccount == NULL) { /* Try the Knuth-Morris-Pratt algorithm. */ - const char *result; + const unsigned char *result; bool success = - knuth_morris_pratt_unibyte (haystack, needle - 1, - &result); + knuth_morris_pratt ((const unsigned char *) haystack, + (const unsigned char *) (needle - 1), + strlen (needle - 1), + &result); if (success) return (char *) result; try_kmp = false;