-typedef struct PCRS_MATCH {
- /* char *buffer; */
- int submatches; /* Number of submatches. Note: The zeroth is the whole match */
- int submatch_offset[PCRS_MAX_SUBMATCHES]; /* Offset for each submatch in the subject */
- int submatch_length[PCRS_MAX_SUBMATCHES]; /* Length of each submatch in the subject */
+
+/*
+ * A match, including all captured subpatterns (submatches)
+ * Note: The zeroth is the whole match, the PCRS_MAX_SUBMATCHES + 0th
+ * is the range before the match, the PCRS_MAX_SUBMATCHES + 1th is the
+ * range after the match.
+ */
+
+typedef struct {
+ int submatches; /* Number of captured subpatterns */
+ int submatch_offset[PCRS_MAX_SUBMATCHES + 2]; /* Offset for each submatch in the subject */
+ size_t submatch_length[PCRS_MAX_SUBMATCHES + 2]; /* Length of each submatch in the subject */