save_schematic(): avoid copying schname to xctx->sch[xctx->currsch] if dest == src

This commit is contained in:
stefan schippers 2023-06-22 08:16:19 +02:00
parent 7ba1acb6d0
commit f85d46a0cb
1 changed files with 5 additions and 2 deletions

View File

@ -2330,8 +2330,11 @@ int save_schematic(const char *schname) /* 20171020 added return value */
xRect *rect;
int rects;
if( strcmp(schname,"") ) my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], schname);
else return 0;
if( strcmp(schname,"")) {
if(!xctx->sch[xctx->currsch] || strcmp(schname, xctx->sch[xctx->currsch])) {
my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], schname);
}
} else return 0;
dbg(1, "save_schematic(): currsch=%d name=%s\n",xctx->currsch, schname);
dbg(1, "save_schematic(): sch[currsch]=%s\n", xctx->sch[xctx->currsch]);
/* dbg(1, "save_schematic(): abs_sym_path=%s\n", abs_sym_path(xctx->sch[xctx->currsch], "")); */