int r;
int rv[5];
size_t i;
- pcre *multi_re = test_compile_re ("multi");
- pcre *match_re = test_compile_re ("match");
- pcre *ing_re = test_compile_re ("ing");
- pcre *str_re = test_compile_re ("str");
- pcre *s_re = test_compile_re ("s");
- const int ovecsize = 12;
- int ovector[ovecsize];
+ pcre2_code *multi_re = test_compile_re ("multi");
+ pcre2_code *match_re = test_compile_re ("match");
+ pcre2_code *ing_re = test_compile_re ("ing");
+ pcre2_code *str_re = test_compile_re ("str");
+ pcre2_code *s_re = test_compile_re ("s");
+ pcre2_match_data *match_data = pcre2_match_data_create (4, NULL);
/* If the subprocess prints multiple things, we should be able to
* repeatedly call mexp_expect to match on each one. This didn't
{ 103, str_re },
{ 104, s_re },
{ 0 },
- }, ovector, ovecsize);
+ }, match_data);
switch (r) {
case 100: case 101: case 102: case 103: case 104:
printf ("iteration %zu: matched %d\n", i, r);
perror ("mexp_expect");
exit (EXIT_FAILURE);
case MEXP_PCRE_ERROR:
- fprintf (stderr, "error: PCRE error: %d\n", h->pcre_error);
+ fprintf (stderr, "error: PCRE error: %d\n", mexp_get_pcre_error (h));
exit (EXIT_FAILURE);
}
}
exit (EXIT_FAILURE);
}
+ pcre2_code_free (multi_re);
+ pcre2_code_free (match_re);
+ pcre2_code_free (ing_re);
+ pcre2_code_free (str_re);
+ pcre2_code_free (s_re);
+ pcre2_match_data_free (match_data);
+
exit (EXIT_SUCCESS);
}