aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2005-03-17 22:11:09 +0000
committerMark Kettenis <kettenis@gnu.org>2005-03-17 22:11:09 +0000
commitbde2058dde90fc3c353df5aace64005d399ee24a (patch)
tree37d84c0de40cbf4a2a862d12f82ca42faae1b5e4 /gdb/utils.c
parent3ecda4574edb38ad12fb491ccaf6d9b0caa3a07a (diff)
downloadgdb-bde2058dde90fc3c353df5aace64005d399ee24a.zip
gdb-bde2058dde90fc3c353df5aace64005d399ee24a.tar.gz
gdb-bde2058dde90fc3c353df5aace64005d399ee24a.tar.bz2
* defs.h (xsnprintf): New prototype.
* utils.c (xsnprintf): New function.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c14
1 files changed, 14 insertions, 0 deletions
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. */