+
+static void add_regex(const char *restr)
+{
+ regexes = xrealloc(regexes, sizeof(regex_t) * (++nregexes));
+ xregcomp(®exes[nregexes-1], restr, reflags);
+}
+
+
+static void load_regexes_from_file(const char *filename)
+{
+ char *line;
+ FILE *f = xfopen(filename, "r");
+ while ((line = get_line_from_file(f)) != NULL) {
+ chomp(line);
+ add_regex(line);
+ free(line);
+ }
+}
+
+
+#ifdef BB_FEATURE_CLEAN_UP
+static void destroy_regexes()
+{
+ if (regexes == NULL)
+ return;
+
+ /* destroy all the elments in the array */
+ while (--nregexes >= 0) {
+ regfree(®exes[nregexes]);
+ free(®exes[nregexes]);
+ }
+}
+#endif
+
+