regex: Fix fastmap for multibyte character ranges.
[gnulib.git] / tests / test-strcasestr.c
index 9db62f1..4abf49a 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <string.h>
 
+#include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -30,6 +31,7 @@
       if (!(expr))                                                          \
         {                                                                   \
           fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+          fflush (stderr);                                                  \
           abort ();                                                         \
         }                                                                   \
     }                                                                       \
@@ -41,8 +43,9 @@ main ()
 #if HAVE_DECL_ALARM
   /* Declare failure if test takes too long, by using default abort
      caused by SIGALRM.  All known platforms that lack alarm also lack
-     memmem, and the replacement memmem is known to not take too
+     strcasestr, and the replacement strcasestr is known to not take too
      long.  */
+  signal (SIGALRM, SIG_DFL);
   alarm (50);
 #endif
 
@@ -144,10 +147,8 @@ main ()
        result = strcasestr (haystack, needle);
        ASSERT (result == haystack + m);
       }
-    if (needle != NULL)
-      free (needle);
-    if (haystack != NULL)
-      free (haystack);
+    free (needle);
+    free (haystack);
   }
 
   return 0;