Index: drc_query.c =================================================================== --- drc_query.c (revision 30205) +++ drc_query.c (revision 30206) @@ -192,6 +192,22 @@ } } +static void drc_legacy(const char *dst_path, const char *legacy_path) +{ + conf_native_t *nl = pcb_conf_get_field(legacy_path); + if (nl != NULL) { + gds_t tmp; + + gds_init(&tmp); + pcb_conf_print_native_field((conf_pfn)pcb_append_printf, &tmp, 0, &nl->val, nl->type, nl->prop, 0); + if (tmp.used > 0) + pcb_conf_set(CFR_INTERNAL, dst_path, -1, tmp.array, POL_OVERWRITE); + gds_uninit(&tmp); + } + else + pcb_message(PCB_MSG_ERROR, "drc_query: invalid legacy path '%s' for %s\n", legacy_path, dst_path); +} + static conf_native_t *nat_defs = NULL; static void drc_query_newconf(conf_native_t *cfg, pcb_conf_listitem_t *i) { @@ -206,10 +222,7 @@ lht_node_t *nd = i->prop.src; char *path = pcb_concat("design/drc/", nd->name, NULL); static pcb_coord_t c; - gds_t tmp; - gds_init(&tmp); - if (pcb_conf_get_field(path) == NULL) { lht_node_t *ndesc = lht_dom_hash_get(nd, "desc"); lht_node_t *ntype = lht_dom_hash_get(nd, "type"); @@ -235,23 +248,14 @@ } pcb_conf_reg_field_(&c, 1, type, path, pcb_strdup(sdesc), 0); - if (slegacy != NULL) { - conf_native_t *nl = pcb_conf_get_field(slegacy); - if (nl != NULL) { - pcb_conf_print_native_field((conf_pfn)pcb_append_printf, &tmp, 0, &nl->val, nl->type, nl->prop, 0); - if (tmp.used > 0) - sdefault = tmp.array; - } - else - pcb_message(PCB_MSG_ERROR, "drc_query: invalid legacy path '%s' for %s\n", slegacy, nd->name); - } - if (sdefault != NULL) + if (slegacy != NULL) + drc_legacy(path, slegacy); + else if (sdefault != NULL) pcb_conf_set(CFR_INTERNAL, path, -1, sdefault, POL_OVERWRITE); path = NULL; /* hash key shall not be free'd */ } fail:; free(path); - gds_uninit(&tmp); } }