--- ray/src/rt/text.c 1992/10/02 16:20:26 2.7 +++ ray/src/rt/text.c 1992/11/22 17:54:00 2.10 @@ -1,4 +1,4 @@ -/* Copyright (c) 1991 Regents of the University of California */ +/* Copyright (c) 1992 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; @@ -142,7 +142,6 @@ char *s; if ((tl=(TLINE *)malloc(sizeof(TLINE)+siz)) == NULL || (tl->spc=(short *)malloc(siz*sizeof(short))) == NULL) error(SYSTEM, "out of memory in tlalloc"); - tl->spc = NULL; tl->next = NULL; strcpy(TLSTR(tl), s); return(tl); @@ -171,7 +170,7 @@ register OBJREC *tm; if (tm->oargs.nsargs - tndx(tm) < 1 || tm->oargs.nfargs < sndx(tm)) objerror(tm, USER, "bad # arguments"); if ((t = (TEXT *)malloc(sizeof(TEXT))) == NULL) - goto memerr; + error(SYSTEM, "out of memory in gettext"); /* compute vectors */ fcross(DxR, D, R); fcross(t->right, DxR, D); @@ -223,9 +222,6 @@ register OBJREC *tm; i = d * 256.0; t->tl.width = 0; for (tlp = t->tl.next; tlp != NULL; tlp = tlp->next) { - if ((tlp->spc = (short *)malloc( - (strlen(TLSTR(tlp))+1)*sizeof(short))) == NULL) - goto memerr; if (i < 0) tlp->width = squeeztext(tlp->spc, TLSTR(tlp), t->f, -i); else if (i > 0) @@ -238,8 +234,6 @@ register OBJREC *tm; /* we're done */ tm->os = (char *)t; return(t); -memerr: - error(SYSTEM, "out of memory in gettext"); #undef R #undef D } @@ -254,7 +248,8 @@ OBJREC *m; tp = (TEXT *)m->os; if (tp == NULL) return; - for (tlp = tp->tl.next; tlp != NULL; tlp = tlp->next) { + while ((tlp = tp->tl.next) != NULL) { + tp->tl.next = tlp->next; free((char *)tlp->spc); free((char *)tlp); }