Removed static buffer.
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Fri, 28 Mar 2003 17:30:25 +0000 (17:30 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Fri, 28 Mar 2003 17:30:25 +0000 (17:30 +0000)
[r1011]

ir/tv/fltcalc.c
ir/tv/fltcalc.h
ir/tv/tv.c

index c493d55..3be4cf1 100644 (file)
@@ -147,10 +147,8 @@ int fc_comp(const void *a, const void *b)
   else return (CAST_IN(a) > CAST_IN(b))?(1):(-1);
 }
 
-char *fc_print_dec(const void *a)
+char *fc_print_dec(const void *a, char *buf, int buflen)
 {
-  static char buf[100];
-
-  snprintf(buf, 100, "%1.30Lg", CAST_IN(a));
+  snprintf(buf, buflen, "%1.30Lg", CAST_IN(a));
   return buf;
 }
index 5e611dc..63e2c80 100644 (file)
@@ -28,7 +28,7 @@ void fc_get_nan(void);
 void fc_get_inf(void);
 
 void fc_calc(const void *a, const void *b, int opcode);
-char *fc_print_dec(const void *a);
+char *fc_print_dec(const void *a, char *buf, int buflen);
 int fc_comp(const void *a, const void *b);
 
 #endif /* _FLTCALC_H_ */
index a234632..af40802 100644 (file)
@@ -864,6 +864,7 @@ int tarval_print(XP_PAR1, const xprintf_info *info ATTRIBUTE((unused)), XP_PARN)
   tarval *tv;
   char *str;
   int offset;
+  char buf[100];
 
   tv = XP_GETARG(tarval *, 0);
   switch (get_mode_sort(tv->mode))
@@ -875,7 +876,7 @@ int tarval_print(XP_PAR1, const xprintf_info *info ATTRIBUTE((unused)), XP_PARN)
       return XPF1R("0x%s", str + offset);
 
     case float_number:
-      return XPF1R("%s", fc_print_dec(tv->value));
+      return XPF1R("%s", fc_print_dec(tv->value, buf, sizeof(buf)));
 
     case reference:
       if (tv->value != NULL)