--- ray/src/cv/mgflib/parser.c 1994/06/24 16:28:18 1.6 +++ ray/src/cv/mgflib/parser.c 1994/06/25 16:33:09 1.9 @@ -170,7 +170,7 @@ int mg_entity(name) /* get entity number from its name */ char *name; { - static LUTAB ent_tab; /* entity lookup table */ + static LUTAB ent_tab = LU_SINIT(NULL,NULL); /* lookup table */ register char *cp; if (!ent_tab.tsiz) { /* initialize hash table */ @@ -215,7 +215,7 @@ char *fn; ctx->lineno = 0; if (fn == NULL) { - ctx->fname = ""; + strcpy(ctx->fname, ""); ctx->fp = stdin; ctx->prev = mg_file; mg_file = ctx; @@ -227,17 +227,12 @@ char *fn; olen = cp - mg_file->fname + 1; else olen = 0; - ctx->fname = (char *)malloc(olen+strlen(fn)+1); - if (ctx->fname == NULL) - return(MG_EMEM); if (olen) strcpy(ctx->fname, mg_file->fname); strcpy(ctx->fname+olen, fn); ctx->fp = fopen(ctx->fname, "r"); - if (ctx->fp == NULL) { - free((MEM_PTR)ctx->fname); + if (ctx->fp == NULL) return(MG_ENOFILE); - } ctx->prev = mg_file; /* establish new context */ mg_file = ctx; return(MG_OK); @@ -253,7 +248,6 @@ mg_close() /* close input file */ if (ctx->fp == stdin) return; /* don't close standard input */ fclose(ctx->fp); - free((MEM_PTR)ctx->fname); } @@ -928,7 +922,7 @@ char **av; if ((rv = handle_it(MG_E_FACE, i, newav)) != MG_OK) return(rv); /* compute face normal */ - if ((cv0 = c_getvert(av[2])) == NULL) + if ((cv0 = c_getvert(av[1])) == NULL) return(MG_EUNDEF); norm[0] = norm[1] = norm[2] = 0.; v1[0] = v1[1] = v1[2] = 0.;