autoupdate
[gnulib.git] / lib / mbscasestr.c
index 82eb968..7a34663 100644 (file)
@@ -1,5 +1,5 @@
 /* Case-insensitive searching in a string.
-   Copyright (C) 2005-2007 Free Software Foundation, Inc.
+   Copyright (C) 2005-2008 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2005.
 
    This program is free software: you can redistribute it and/or modify
@@ -25,9 +25,7 @@
 #include <stddef.h>  /* for NULL, in case a nonstandard string.h lacks it */
 
 #include "malloca.h"
-#if HAVE_MBRTOWC
-# include "mbuiter.h"
-#endif
+#include "mbuiter.h"
 
 #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
 
 #define CANON_ELEMENT(c) TOLOWER (c)
 #include "str-kmp.h"
 
-#if HAVE_MBRTOWC
 /* Knuth-Morris-Pratt algorithm.
    See http://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm
-   Return a boolean indicating success.  */
+   Return a boolean indicating success:
+   Return true and set *RESULTP if the search was completed.
+   Return false if it was aborted because not enough memory was available.  */
 static bool
 knuth_morris_pratt_multibyte (const char *haystack, const char *needle,
                              const char **resultp)
@@ -190,7 +189,6 @@ knuth_morris_pratt_multibyte (const char *haystack, const char *needle,
   freea (memory);
   return true;
 }
-#endif
 
 /* Find the first occurrence of the character string NEEDLE in the character
    string HAYSTACK, using case-insensitive comparison.
@@ -204,7 +202,6 @@ mbscasestr (const char *haystack, const char *needle)
        - haystack may be very long, and a match of needle found early,
        - needle may be very long, and not even a short initial segment of
          needle may be found in haystack.  */
-#if HAVE_MBRTOWC
   if (MB_CUR_MAX > 1)
     {
       mbui_iterator_t iter_needle;
@@ -317,7 +314,6 @@ mbscasestr (const char *haystack, const char *needle)
        return (char *) haystack;
     }
   else
-#endif
     {
       if (*needle != '\0')
        {