Return int from mexp_expect
[miniexpect.git] / miniexpect.c
index 77d781c..9f3b7ba 100644 (file)
@@ -244,7 +244,7 @@ mexp_spawnvf (unsigned flags, const char *file, char **argv)
   return NULL;
 }
 
-enum mexp_status
+int
 mexp_expect (mexp_h *h, const mexp_regexp *regexps,
              pcre2_match_data *match_data)
 {
@@ -356,7 +356,7 @@ mexp_expect (mexp_h *h, const mexp_regexp *regexps,
           if (match_data)
             ovector = pcre2_get_ovector_pointer (match_data);
 
-          if (ovector != NULL && ovector[1] >= 0)
+          if (ovector != NULL && ovector[1] != ~(PCRE2_SIZE)0)
             h->next_match = ovector[1];
           else
             h->next_match = -1;