forked from Imagelibrary/binutils-gdb
* defs.h (xsnprintf): New prototype.
* utils.c (xsnprintf): New function.
This commit is contained in:
14
gdb/utils.c
14
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. */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user