Skip to content

Commit

Permalink
perf: Minor optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregungory committed Dec 12, 2024
1 parent 051033c commit 25669a8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 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.36 2024/12/12 19:55:57 greg Exp $";
static const char RCSid[] = "$Id: mesh.c,v 2.37 2024/12/12 23:04:31 greg Exp $";
#endif
/*
* Mesh support routines
Expand Down Expand Up @@ -72,7 +72,7 @@ cvcmp(const char *vv1, const char *vv2) /* compare encoded vertices */


MESH *
getmesh( /* get new mesh data reference */
getmesh( /* get mesh data reference */
char *mname,
int flags
)
Expand All @@ -82,20 +82,18 @@ getmesh( /* get new mesh data reference */

flags &= IO_LEGAL;
for (ms = mlist; ms != NULL; ms = ms->next)
if (!strcmp(mname, ms->name)) {
ms->nref++; /* increase reference count */
if (!strcmp(mname, ms->name))
break;
}
if (ms == NULL) { /* new mesh entry? */
ms = (MESH *)calloc(1, sizeof(MESH));
if (ms == NULL)
error(SYSTEM, "out of memory in getmesh");
ms->name = savestr(mname);
ms->nref = 1;
ms->mcube.cutree = EMPTY;
ms->next = mlist;
mlist = ms;
}
ms->nref++; /* bump reference count */
if (!(flags &= ~ms->ldflags)) /* nothing to load? */
return(ms);
if ((pathname = getpath(mname, getrlibpath(), R_OK)) == NULL) {
Expand Down

0 comments on commit 25669a8

Please sign in to comment.