Index: trunk/src_plugins/io_kicad_legacy/uniq_name.c =================================================================== --- trunk/src_plugins/io_kicad_legacy/uniq_name.c (revision 2665) +++ trunk/src_plugins/io_kicad_legacy/uniq_name.c (revision 2666) @@ -34,6 +34,11 @@ const char *head; if ((orig_name == NULL) || (*orig_name == '\0')) { + if (!htsp_has(&state->seen, (char *)state->unnamed)) { + name = pcb_strdup(state->unnamed); + htsp_set(&state->seen, name, name); + return name; + } head = state->unnamed; l1 = strlen(state->unnamed); l2 = strlen(state->suffix_sep); Index: trunk/src_plugins/io_kicad_legacy/uniq_name.h =================================================================== --- trunk/src_plugins/io_kicad_legacy/uniq_name.h (revision 2665) +++ trunk/src_plugins/io_kicad_legacy/uniq_name.h (revision 2666) @@ -20,7 +20,11 @@ - if orig_name is NULL, generate an unnamed item - if orig_name is not-NULL and is unseen so far, return a copy of orig_name - if orig_name is not-NULL and has been already seen, return a modified version + + Corners: - an empty, non-NULL orig_name handled as if it was NULL + - the first "unnamed" entry is returned without suffix + Strings returned are newly allocated and can be used until unm_uninit() is called on state. */ const char *unm_name(unm_t *state, const char *orig_name);