Fix return value.
authorBruno Haible <bruno@clisp.org>
Fri, 19 Aug 2005 11:00:51 +0000 (11:00 +0000)
committerBruno Haible <bruno@clisp.org>
Fri, 19 Aug 2005 11:00:51 +0000 (11:00 +0000)
lib/ChangeLog
lib/strcasestr.c
lib/strstr.c

index 60a56d6..3f6d105 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-18  Bruno Haible  <bruno@clisp.org>
+
+       * strstr.c (strstr): Fix return value in multibyte case.
+       * strcasestr.c (strcasestr): Likewise.
+
 2005-08-17  Jim Meyering  <jim@meyering.net>
 
        Make the %s format (seconds since the epoch) work for a negative
index de4cf45..5a0fc42 100644 (file)
@@ -88,7 +88,7 @@ strcasestr (const char *haystack, const char *needle)
                    {
                      if (!mbui_avail (rneedle))
                        /* Found a match.  */
-                       return (char *) haystack;
+                       return (char *) mbui_cur_ptr (iter_haystack);
                      if (!mbui_avail (rhaystack))
                        /* No match.  */
                        return NULL;
index 5bd7cb4..3faae01 100644 (file)
@@ -71,7 +71,7 @@ strstr (const char *haystack, const char *needle)
                    {
                      if (!mbui_avail (rneedle))
                        /* Found a match.  */
-                       return (char *) haystack;
+                       return (char *) mbui_cur_ptr (iter_haystack);
                      if (!mbui_avail (rhaystack))
                        /* No match.  */
                        return NULL;