diff options
author | thevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-11-26 13:55:28 +0000 |
---|---|---|
committer | thevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-11-26 13:55:28 +0000 |
commit | 38e82e3070c722fdbfb93b55367a65f28cddea37 (patch) | |
tree | b0f99b3300785f84808f623e9604a98a5735b145 /printf.c | |
parent | 18914c3de5891d063cb86f6fda6d75e2695cb6a6 (diff) | |
download | mpfr-38e82e3070c722fdbfb93b55367a65f28cddea37.tar.gz |
printf.c: fix use of pointer of string
vasprintf.c: add conditional compilation directives for wchar and wint_t
vasprintf.c: add padding for special values
vasprintf.c: fix output for value 1.0 and format "%Rf"
vasprintf.c: replace __gmp_const by const
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@5015 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'printf.c')
-rw-r--r-- | printf.c | 60 |
1 files changed, 30 insertions, 30 deletions
@@ -31,20 +31,20 @@ int mpfr_printf (__gmp_const char *fmt, ...) { va_list ap; - char **strp = NULL; + char *strp; int ret; va_start (ap, fmt); - if (mpfr_vasprintf (strp, fmt, ap) < 0) + if (mpfr_vasprintf (&strp, fmt, ap) < 0) { - mpfr_free_str (*strp); + mpfr_free_str (strp); va_end (ap); return -1; } - ret = printf (*strp); + ret = printf (strp); - mpfr_free_str (*strp); + mpfr_free_str (strp); va_end (ap); return ret; } @@ -52,18 +52,18 @@ mpfr_printf (__gmp_const char *fmt, ...) int mpfr_vprintf (__gmp_const char *fmt, va_list ap) { - char **strp = NULL; + char *strp; int ret; - if (mpfr_vasprintf (strp, fmt, ap) < 0) + if (mpfr_vasprintf (&strp, fmt, ap) < 0) { - mpfr_free_str (*strp); + mpfr_free_str (strp); return -1; } - ret = printf (*strp); + ret = printf (strp); - mpfr_free_str (*strp); + mpfr_free_str (strp); return ret; } @@ -72,20 +72,20 @@ int mpfr_fprintf (FILE *fp, __gmp_const char *fmt, ...) { va_list ap; - char **strp = NULL; + char *strp; int ret; va_start (ap, fmt); - if (mpfr_vasprintf (strp, fmt, ap) < 0) + if (mpfr_vasprintf (&strp, fmt, ap) < 0) { - mpfr_free_str (*strp); + mpfr_free_str (strp); va_end (ap); return -1; } - ret = fprintf (fp, *strp); + ret = fprintf (fp, strp); - mpfr_free_str (*strp); + mpfr_free_str (strp); va_end (ap); return ret; } @@ -93,18 +93,18 @@ mpfr_fprintf (FILE *fp, __gmp_const char *fmt, ...) int mpfr_vfprintf (FILE *fp, __gmp_const char *fmt, va_list ap) { - char **strp = NULL; + char *strp; int ret; - if (mpfr_vasprintf (strp, fmt, ap) < 0) + if (mpfr_vasprintf (&strp, fmt, ap) < 0) { - mpfr_free_str (*strp); + mpfr_free_str (strp); return -1; } - ret = fprintf (fp, *strp); + ret = fprintf (fp, strp); - mpfr_free_str (*strp); + mpfr_free_str (strp); return ret; } #endif /* _MPFR_H_HAVE_FILE */ @@ -125,18 +125,18 @@ mpfr_sprintf (char *buf, __gmp_const char *fmt, ...) int mpfr_vsprintf (char *buf, __gmp_const char *fmt, va_list ap) { - char *strp[1]; + char *strp; int ret; - if ((ret = mpfr_vasprintf (strp, fmt, ap)) < 0) + if ((ret = mpfr_vasprintf (&strp, fmt, ap)) < 0) { - mpfr_free_str (*strp); + mpfr_free_str (strp); return -1; } - ret = sprintf (buf, *strp); + ret = sprintf (buf, strp); - mpfr_free_str (*strp); + mpfr_free_str (strp); return ret; } @@ -156,18 +156,18 @@ mpfr_snprintf (char *buf, size_t size, __gmp_const char *fmt, ...) int mpfr_vsnprintf (char *buf, size_t size, __gmp_const char *fmt, va_list ap) { - char **strp = NULL; + char *strp; int ret; - if (mpfr_vasprintf (strp, fmt, ap) < 0) + if (mpfr_vasprintf (&strp, fmt, ap) < 0) { - mpfr_free_str (*strp); + mpfr_free_str (strp); return -1; } - ret = snprintf (buf, size, *strp); + ret = snprintf (buf, size, &strp); - mpfr_free_str (*strp); + mpfr_free_str (strp); return ret; } |