From bde2058dde90fc3c353df5aace64005d399ee24a Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Thu, 17 Mar 2005 22:11:09 +0000 Subject: * defs.h (xsnprintf): New prototype. * utils.c (xsnprintf): New function. --- gdb/utils.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'gdb/utils.c') diff --git a/gdb/utils.c b/gdb/utils.c index 7ee2061..0c45108 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1079,6 +1079,20 @@ xstrvprintf (const char *format, va_list ap) return ret; } +int +xsnprintf (char *str, size_t size, const char *format, ...) +{ + va_list args; + int ret; + + va_start (args, format); + ret = vsnprintf (str, size, format, args); + gdb_assert (ret < size); + va_end (args); + + return ret; +} + /* My replacement for the read system call. Used like `read' but keeps going if `read' returns too soon. */ -- cgit v1.1