Skip to content

Commit

Permalink
perf: Eliminated unnecessary call to getpath() with previously loaded…
Browse files Browse the repository at this point in the history
… mesh
  • Loading branch information
Gregungory committed Dec 12, 2024
1 parent 529e1bb commit cc05d24
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/common/mesh.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static const char RCSid[] = "$Id: mesh.c,v 2.35 2021/06/10 00:27:25 greg Exp $";
static const char RCSid[] = "$Id: mesh.c,v 2.36 2024/12/12 19:55:57 greg Exp $";
#endif
/*
* Mesh support routines
Expand Down Expand Up @@ -86,7 +86,7 @@ getmesh( /* get new mesh data reference */
ms->nref++; /* increase reference count */
break;
}
if (ms == NULL) { /* load first time */
if (ms == NULL) { /* new mesh entry? */
ms = (MESH *)calloc(1, sizeof(MESH));
if (ms == NULL)
error(SYSTEM, "out of memory in getmesh");
Expand All @@ -96,13 +96,13 @@ getmesh( /* get new mesh data reference */
ms->next = mlist;
mlist = ms;
}
if (!(flags &= ~ms->ldflags)) /* nothing to load? */
return(ms);
if ((pathname = getpath(mname, getrlibpath(), R_OK)) == NULL) {
sprintf(errmsg, "cannot find mesh file \"%s\"", mname);
error(SYSTEM, errmsg);
}
flags &= ~ms->ldflags;
if (flags)
readmesh(ms, pathname, flags);
readmesh(ms, pathname, flags);
return(ms);
}

Expand Down

0 comments on commit cc05d24

Please sign in to comment.