+#ifndef HAVE_RE_SEARCH
+
+// the array of offsets for the matches, the usual POSIX regmatch_t array.
+class wxRegExMatches
+{
+public:
+ typedef regmatch_t *match_type;
+
+ wxRegExMatches(size_t n) { m_matches = new regmatch_t[n]; }
+ ~wxRegExMatches() { delete [] m_matches; }
+
+ size_t Start(size_t n) const { return m_matches[n].rm_so; }
+ size_t End(size_t n) const { return m_matches[n].rm_eo; }
+
+ regmatch_t *get() const { return m_matches; }
+
+private:
+ regmatch_t *m_matches;
+};
+
+#else // HAVE_RE_SEARCH
+
+// the array of offsets for the matches, the struct used by the GNU lib
+class wxRegExMatches
+{
+public:
+ typedef re_registers *match_type;
+
+ wxRegExMatches(size_t n)
+ {
+ m_matches.num_regs = n;
+ m_matches.start = new regoff_t[n];
+ m_matches.end = new regoff_t[n];
+ }
+
+ ~wxRegExMatches()
+ {
+ delete [] m_matches.start;
+ delete [] m_matches.end;
+ }
+
+ size_t Start(size_t n) const { return m_matches.start[n]; }
+ size_t End(size_t n) const { return m_matches.end[n]; }
+
+ re_registers *get() { return &m_matches; }
+
+private:
+ re_registers m_matches;
+};
+
+#endif // HAVE_RE_SEARCH
+