+static struct qosify_map_entry *
+__qosify_map_alloc_entry(struct qosify_map_data *data)
+{
+ struct qosify_map_entry *e;
+ char *pattern;
+
+ if (data->id < CL_MAP_DNS) {
+ e = calloc(1, sizeof(*e));
+ memcpy(&e->data.addr, &data->addr, sizeof(e->data.addr));
+
+ return e;
+ }
+
+ e = calloc_a(sizeof(*e), &pattern, strlen(data->addr.dns.pattern) + 1);
+ strcpy(pattern, data->addr.dns.pattern);
+ e->data.addr.dns.pattern = pattern;
+ if (regcomp(&e->data.addr.dns.regex, pattern,
+ REG_EXTENDED | REG_ICASE | REG_NOSUB)) {
+ free(e);
+ return NULL;
+ }
+
+ return e;
+}
+