From: Michael Beck Date: Fri, 28 Mar 2003 17:30:25 +0000 (+0000) Subject: Removed static buffer. X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=ed7dd996981ad697458da401fb1638cc2a1aa977;p=libfirm Removed static buffer. [r1011] --- diff --git a/ir/tv/fltcalc.c b/ir/tv/fltcalc.c index c493d5569..3be4cf19c 100644 --- a/ir/tv/fltcalc.c +++ b/ir/tv/fltcalc.c @@ -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; } diff --git a/ir/tv/fltcalc.h b/ir/tv/fltcalc.h index 5e611dc00..63e2c8029 100644 --- a/ir/tv/fltcalc.h +++ b/ir/tv/fltcalc.h @@ -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_ */ diff --git a/ir/tv/tv.c b/ir/tv/tv.c index a23463230..af40802e3 100644 --- a/ir/tv/tv.c +++ b/ir/tv/tv.c @@ -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)