aboutsummaryrefslogtreecommitdiff
path: root/gdb/common/common-utils.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-09-28 07:44:50 -0600
committerTom Tromey <tom@tromey.com>2017-09-29 20:46:42 -0600
commitbd413795d364d3bed8dbb8c596cb45c82ed31041 (patch)
treea5ab5045c72498fe96689c39d2d6abd192e6ce1b /gdb/common/common-utils.h
parent8b5b25295998e10723bd51d127c87249a779f628 (diff)
downloadbinutils-bd413795d364d3bed8dbb8c596cb45c82ed31041.zip
binutils-bd413795d364d3bed8dbb8c596cb45c82ed31041.tar.gz
binutils-bd413795d364d3bed8dbb8c596cb45c82ed31041.tar.bz2
Introduce string_vprintf
This adds string_vprintf, a va_list variant of string_printf. This will be used in later patches. gdb/ChangeLog 2017-09-29 Tom Tromey <tom@tromey.com> * unittests/common-utils-selftests.c (format): New function. (string_vprintf_tests): New function. (_initialize_common_utils_selftests): Register new tests. * common/common-utils.c (string_vprintf): New function. * common/common-utils.h (string_vprintf): Declare.
Diffstat (limited to 'gdb/common/common-utils.h')
-rw-r--r--gdb/common/common-utils.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/common/common-utils.h b/gdb/common/common-utils.h
index 6475c28..19724f9 100644
--- a/gdb/common/common-utils.h
+++ b/gdb/common/common-utils.h
@@ -63,6 +63,10 @@ int xsnprintf (char *str, size_t size, const char *format, ...)
std::string string_printf (const char* fmt, ...)
ATTRIBUTE_PRINTF (1, 2);
+/* Like string_printf, but takes a va_list. */
+std::string string_vprintf (const char* fmt, va_list args)
+ ATTRIBUTE_PRINTF (1, 0);
+
/* Make a copy of the string at PTR with LEN characters
(and add a null character at the end in the copy).
Uses malloc to get the space. Returns the address of the copy. */