re_set_syntax (tests[i].syntax | RE_ICASE); memset (&regbuf, '\0', sizeof (regbuf)); err = re_compile_pattern (tests[i].pattern, strlen (tests[i].pattern), &regbuf); if (err != NULL) { printf ("re_compile_pattern failed: %s\n", err); ret = 1; continue; }   optimized = ((re_dfa_t *) regbuf.buffer)->mb_cur_max == 1; if (optimized) { printf ("pattern %zd optimized while it should not be when case insensitive\n", i); ret = 1; }  res = re_search (&regbuf, tests[i].string, strlen (tests[i].string), 0, strlen (tests[i].string), NULL); if (res != tests[i].res) { printf ("re_search %zd failed: %d\n", i, res); ret = 1; regfree (&regbuf); continue; } regfree (&regbuf);
main (void){  struct re_pattern_buffer regbuf;  const char *err;  size_t i;  int ret = 0;  mtrace ();  setlocale (LC_ALL, "de_DE.UTF-8");  for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)    {      int res, optimized;      re_set_syntax (tests[i].syntax);      memset (&regbuf, '\0', sizeof (regbuf));      err = re_compile_pattern (tests[i].pattern, strlen (tests[i].pattern),                                &regbuf);      if (err != NULL)	{	  printf ("re_compile_pattern failed: %s\n", err);	  ret = 1;	  continue;	}      /* Check if re_search will be done as multi-byte or single-byte.  */      optimized = ((re_dfa_t *) regbuf.buffer)->mb_cur_max == 1;      if (optimized != tests[i].optimize)        {          printf ("pattern %zd %soptimized while it should%s be\n",		  i, optimized ? "" : "not ", tests[i].optimize ? "" : " not");	  ret = 1;        }      res = re_search (&regbuf, tests[i].string, strlen (tests[i].string), 0,		       strlen (tests[i].string), NULL);      if (res != tests[i].res)	{	  printf ("re_search %zd failed: %d\n", i, res);	  ret = 1;	  regfree (&regbuf);	  continue;	}      regfree (&regbuf);    }  return ret;}