diff options
-rw-r--r-- | obj.c | 11 | ||||
-rw-r--r-- | obj.h | 1 |
2 files changed, 5 insertions, 7 deletions
@@ -87,15 +87,12 @@ addvert(OBJ *obj, OBJVertex v, int vtype) static void addelem(OBJObject *o, OBJElem *e) { - OBJElem *ep; - - if(o->child == nil){ - o->child = e; + if(o->lastone == nil){ + o->lastone = o->child = e; return; } - for(ep = o->child; ep->next != nil; ep = ep->next) - ; - ep->next = e; + o->lastone->next = e; + o->lastone = o->lastone->next; } static OBJElem * @@ -80,6 +80,7 @@ struct OBJObject { char *name; OBJElem *child; + OBJElem *lastone; OBJObject *next; }; |