[BACK]Return to tran.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / awk

Diff for /src/usr.bin/awk/tran.c between version 1.9 and 1.10

version 1.9, 2003/04/04 00:42:34 version 1.10, 2003/04/06 06:12:01
Line 372 
Line 372 
                 if (freeable(vp))                  if (freeable(vp))
                         xfree(vp->sval);                          xfree(vp->sval);
                 if (modf(vp->fval, &dtemp) == 0)        /* it's integral */                  if (modf(vp->fval, &dtemp) == 0)        /* it's integral */
                         sprintf(s, "%.30g", vp->fval);                          snprintf(s, sizeof(s), "%.30g", vp->fval);
                 else                  else
                         sprintf(s, *fmt, vp->fval);                          snprintf(s, sizeof(s), *fmt, vp->fval);
                 vp->sval = tostring(s);                  vp->sval = tostring(s);
                 vp->tval &= ~DONTFREE;                  vp->tval &= ~DONTFREE;
                 vp->tval |= STR;                  vp->tval |= STR;
Line 396 
Line 396 
   
 char *tostring(const char *s)   /* make a copy of string s */  char *tostring(const char *s)   /* make a copy of string s */
 {  {
         char *p;          return (strdup(s));
   
         p = (char *) malloc(strlen(s)+1);  
         if (p == NULL)  
                 FATAL("out of space in tostring on %s", s);  
         strcpy(p, s);  
         return(p);  
 }  }
   
 char *qstring(const char *is, int delim)        /* collect string up to next delim */  char *qstring(const char *is, int delim)        /* collect string up to next delim */

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10