From 01ca36af914385acfc864adfae6923768581888a Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Thu, 11 Dec 2014 09:15:37 +0100 Subject: xvasprintf.c: New file. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * xvasprintf.c: New file. * vprintf-support.h: Likewise. * vprintf-support.c: Likewise. * Makefile.in (CFILES): Add vprintf-support.c, xvasprintf.c. (REQUIRED_OFILES): Add vprintf-support.$(objext), xvasprintf.$(objext). (vprintf-support.$(objext), xvasprintf.$(objext)): New targets. (vasprintf.$(objext)): Depend on $(srcdir)/vprintf-support.h. * functions.texi: Regenerate. * vasprintf.c (int_vasprintf): Use libiberty_vprintf_buffer_size. include/ChangeLog: * libiberty.h (xvasprintf): Declare. libcpp/ChangeLog: * directives.c (cpp_define_formatted): Use xvasprintf. Co-Authored-By: Ben Elliston Co-Authored-By: Manuel López-Ibáñez From-SVN: r218618 --- libcpp/ChangeLog | 4 ++++ libcpp/directives.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'libcpp') diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index e26c8c9..df71ac2 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,7 @@ +2014-12-11 Uros Bizjak + + * directives.c (cpp_define_formatted): Use xvasprintf. + 2014-12-05 Manuel López-Ibáñez * line-map.c (linemap_position_for_loc_and_offset): Add new diff --git a/libcpp/directives.c b/libcpp/directives.c index ba92ec2..c9be412 100644 --- a/libcpp/directives.c +++ b/libcpp/directives.c @@ -2404,11 +2404,11 @@ cpp_define (cpp_reader *pfile, const char *str) void cpp_define_formatted (cpp_reader *pfile, const char *fmt, ...) { - char *ptr = NULL; + char *ptr; va_list ap; va_start (ap, fmt); - vasprintf (&ptr, fmt, ap); + ptr = xvasprintf (fmt, ap); va_end (ap); cpp_define (pfile, ptr); -- cgit v1.1