ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/mesh.c
(Generate patch)

Comparing ray/src/common/mesh.c (file contents):
Revision 2.35 by greg, Thu Jun 10 00:27:25 2021 UTC vs.
Revision 2.37 by greg, Thu Dec 12 23:04:31 2024 UTC

# Line 72 | Line 72 | cvcmp(const char *vv1, const char *vv2)                /* compare en
72  
73  
74   MESH *
75 < getmesh(                                /* get new mesh data reference */
75 > getmesh(                                /* get mesh data reference */
76          char    *mname,
77          int     flags
78   )
# Line 82 | Line 82 | getmesh(                               /* get new mesh data reference */
82  
83          flags &= IO_LEGAL;
84          for (ms = mlist; ms != NULL; ms = ms->next)
85 <                if (!strcmp(mname, ms->name)) {
86 <                        ms->nref++;     /* increase reference count */
85 >                if (!strcmp(mname, ms->name))
86                          break;
87 <                }
89 <        if (ms == NULL) {               /* load first time */
87 >        if (ms == NULL) {               /* new mesh entry? */
88                  ms = (MESH *)calloc(1, sizeof(MESH));
89                  if (ms == NULL)
90                          error(SYSTEM, "out of memory in getmesh");
91                  ms->name = savestr(mname);
94                ms->nref = 1;
92                  ms->mcube.cutree = EMPTY;
93                  ms->next = mlist;
94                  mlist = ms;
95          }
96 +        ms->nref++;                     /* bump reference count */
97 +        if (!(flags &= ~ms->ldflags))   /* nothing to load? */
98 +                return(ms);
99          if ((pathname = getpath(mname, getrlibpath(), R_OK)) == NULL) {
100                  sprintf(errmsg, "cannot find mesh file \"%s\"", mname);
101                  error(SYSTEM, errmsg);
102          }
103 <        flags &= ~ms->ldflags;
104 <        if (flags)
105 <                readmesh(ms, pathname, flags);
103 >        readmesh(ms, pathname, flags);
104          return(ms);
105   }
106  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines