X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=test-multi-match.c;h=dd36c725b931e2b05f759ba00af9775d2debdd45;hb=f50ad471e49d3fc5d4d896fbd5b6d2be93192671;hp=72372029971ea615353fc41047575fe292519fbf;hpb=329575032af72a3155bcc2640231e603604cd253;p=miniexpect.git diff --git a/test-multi-match.c b/test-multi-match.c index 7237202..dd36c72 100644 --- a/test-multi-match.c +++ b/test-multi-match.c @@ -34,13 +34,12 @@ main (int argc, char *argv[]) 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 @@ -58,7 +57,7 @@ main (int argc, char *argv[]) { 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); @@ -74,7 +73,7 @@ main (int argc, char *argv[]) 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); } } @@ -93,5 +92,12 @@ main (int argc, char *argv[]) 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); }