return streq(name1, name2);
}
-HTABLE_DEFINE_TYPE(char, option_name, option_hash, option_cmp, option);
+HTABLE_DEFINE_TYPE(char, option_name, option_hash, option_cmp, htable_option);
+
+static struct htable_option *htable_option_new(void)
+{
+ struct htable_option *opts = malloc(sizeof(*opts));
+ htable_option_init(opts);
+ return opts;
+}
+
+static void htable_option_free(struct htable_option *opts)
+{
+ htable_option_clear(opts);
+ free(opts);
+}
static unsigned int add_options(struct htable_option *opts,
struct pp_conditions *cond)
}
static void do_reduce_features(struct manifest *m,
- bool keep,
unsigned int *timeleft, struct score *score)
{
struct htable_option *options_used, *options_avail, *options;
hdr = talloc_asprintf_append
(hdr, "#undef %s\n#define %s 0\n", sym, sym);
}
- if (mkdir("reduced-features", 0700) != 0)
+ if (mkdir("reduced-features", 0700) != 0 && errno != EEXIST)
err(1, "Creating reduced-features directory");
- fd = open("reduced-features/config.h", O_EXCL|O_CREAT|O_RDWR, 0600);
+ fd = open("reduced-features/config.h", O_TRUNC|O_CREAT|O_RDWR, 0600);
if (fd < 0)
err(1, "Creating reduced-features/config.h");
if (!write_all(fd, hdr, strlen(hdr)))