return pp;
}
+void rx_set_template(rx_t *rx, const char *tpl)
+{
+ const char *p = tpl;
+
+ m_strreplace(&rx->template, tpl);
+ rx->nmatch = 0;
+
+ while ((p = strchr(p, '%'))) {
+ if (isdigit(*++p)) {
+ int n = strtol(p, (char **)&p, 10);
+ rx->nmatch = MAX(n, rx->nmatch);
+ } else {
+ if (*p == '%')
+ p++;
+ }
+ }
+
+ rx->nmatch++; /* match 0 is always the whole expr */
+}
+
void rx_delete(rx_t **p)
{
p_delete(&(*p)->pattern);
regfree((*p)->rx);
p_delete(&(*p)->rx);
+ p_delete(&(*p)->template);
p_delete(p);
}