mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 14:49:38 +08:00
2004-06-28 Andrew Cagney <cagney@gnu.org>
* defs.h (xstrvprintf): Declare. * utils.c (xstrvprintf): New function. (internal_vproblem, xstrprintf, xasprintf) (vfprintf_maybe_filtered, vfprintf_unfiltered): Use xstrvprintf. * serial.c (serial_printf): Ditto. * complaints.c (vcomplaint): Ditto.
This commit is contained in:
@ -1,3 +1,21 @@
|
|||||||
|
? diffs
|
||||||
|
Index: ChangeLog
|
||||||
|
===================================================================
|
||||||
|
RCS file: /cvs/src/src/gdb/ChangeLog,v
|
||||||
|
retrieving revision 1.6061
|
||||||
|
diff -p -u -r1.6061 ChangeLog
|
||||||
|
--- ChangeLog 29 Jun 2004 06:39:05 -0000 1.6061
|
||||||
|
+++ ChangeLog 29 Jun 2004 14:55:28 -0000
|
||||||
|
@@ -1,3 +1,12 @@
|
||||||
|
2004-06-28 Andrew Cagney <cagney@gnu.org>
|
||||||
|
|
||||||
|
* defs.h (xstrvprintf): Declare.
|
||||||
|
* utils.c (xstrvprintf): New function.
|
||||||
|
(internal_vproblem, xstrprintf, xasprintf)
|
||||||
|
(vfprintf_maybe_filtered, vfprintf_unfiltered): Use xstrvprintf.
|
||||||
|
* serial.c (serial_printf): Ditto.
|
||||||
|
* complaints.c (vcomplaint): Ditto.
|
||||||
|
|
||||||
2004-06-29 Corinna Vinschen <vinschen@redhat.com>
|
2004-06-29 Corinna Vinschen <vinschen@redhat.com>
|
||||||
|
|
||||||
* infcmd.c (attach_command): Move call to target_terminal_inferior
|
* infcmd.c (attach_command): Move call to target_terminal_inferior
|
||||||
|
@ -197,7 +197,7 @@ vcomplaint (struct complaints **c, const char *file, int line, const char *fmt,
|
|||||||
{
|
{
|
||||||
char *msg;
|
char *msg;
|
||||||
struct cleanup *cleanups;
|
struct cleanup *cleanups;
|
||||||
xvasprintf (&msg, complaint->fmt, args);
|
msg = xstrvprintf (complaint->fmt, args);
|
||||||
cleanups = make_cleanup (xfree, msg);
|
cleanups = make_cleanup (xfree, msg);
|
||||||
wrap_here ("");
|
wrap_here ("");
|
||||||
if (series != SUBSEQUENT_MESSAGE)
|
if (series != SUBSEQUENT_MESSAGE)
|
||||||
|
@ -892,8 +892,10 @@ extern void xfree (void *);
|
|||||||
extern void xasprintf (char **ret, const char *format, ...) ATTR_FORMAT (printf, 2, 3);
|
extern void xasprintf (char **ret, const char *format, ...) ATTR_FORMAT (printf, 2, 3);
|
||||||
extern void xvasprintf (char **ret, const char *format, va_list ap);
|
extern void xvasprintf (char **ret, const char *format, va_list ap);
|
||||||
|
|
||||||
/* Like asprintf, but return the string, throw an error if no memory. */
|
/* Like asprintf and vasprintf, but return the string, throw an error
|
||||||
|
if no memory. */
|
||||||
extern char *xstrprintf (const char *format, ...) ATTR_FORMAT (printf, 1, 2);
|
extern char *xstrprintf (const char *format, ...) ATTR_FORMAT (printf, 1, 2);
|
||||||
|
extern char *xstrvprintf (const char *format, va_list ap);
|
||||||
|
|
||||||
extern int parse_escape (char **);
|
extern int parse_escape (char **);
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ serial_printf (struct serial *desc, const char *format,...)
|
|||||||
char *buf;
|
char *buf;
|
||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
|
|
||||||
xvasprintf (&buf, format, args);
|
buf = xstrvprintf (format, args);
|
||||||
serial_write (desc, buf, strlen (buf));
|
serial_write (desc, buf, strlen (buf));
|
||||||
|
|
||||||
xfree (buf);
|
xfree (buf);
|
||||||
|
25
gdb/utils.c
25
gdb/utils.c
@ -752,7 +752,7 @@ internal_vproblem (struct internal_problem *problem,
|
|||||||
so that the user knows that they are living on the edge. */
|
so that the user knows that they are living on the edge. */
|
||||||
{
|
{
|
||||||
char *msg;
|
char *msg;
|
||||||
xvasprintf (&msg, fmt, ap);
|
msg = xstrvprintf (fmt, ap);
|
||||||
reason = xstrprintf ("\
|
reason = xstrprintf ("\
|
||||||
%s:%d: %s: %s\n\
|
%s:%d: %s: %s\n\
|
||||||
A problem internal to GDB has been detected,\n\
|
A problem internal to GDB has been detected,\n\
|
||||||
@ -1156,7 +1156,7 @@ xstrprintf (const char *format, ...)
|
|||||||
char *ret;
|
char *ret;
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
xvasprintf (&ret, format, args);
|
ret = xstrvprintf (format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1166,7 +1166,7 @@ xasprintf (char **ret, const char *format, ...)
|
|||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
xvasprintf (ret, format, args);
|
(*ret) = xstrvprintf (format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1186,6 +1186,21 @@ xvasprintf (char **ret, const char *format, va_list ap)
|
|||||||
"vasprintf call failed (errno %d)", errno);
|
"vasprintf call failed (errno %d)", errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
xstrvprintf (const char *format, va_list ap)
|
||||||
|
{
|
||||||
|
char *ret = NULL;
|
||||||
|
int status = vasprintf (&ret, format, ap);
|
||||||
|
/* NULL is returned when there was a memory allocation problem. */
|
||||||
|
if (ret == NULL)
|
||||||
|
nomem (0);
|
||||||
|
/* A negative status (the printed length) with a non-NULL buffer
|
||||||
|
should never happen, but just to be sure. */
|
||||||
|
if (status < 0)
|
||||||
|
internal_error (__FILE__, __LINE__,
|
||||||
|
"vasprintf call failed (errno %d)", errno);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* My replacement for the read system call.
|
/* My replacement for the read system call.
|
||||||
Used like `read' but keeps going if `read' returns too soon. */
|
Used like `read' but keeps going if `read' returns too soon. */
|
||||||
@ -2260,7 +2275,7 @@ vfprintf_maybe_filtered (struct ui_file *stream, const char *format,
|
|||||||
char *linebuffer;
|
char *linebuffer;
|
||||||
struct cleanup *old_cleanups;
|
struct cleanup *old_cleanups;
|
||||||
|
|
||||||
xvasprintf (&linebuffer, format, args);
|
linebuffer = xstrvprintf (format, args);
|
||||||
old_cleanups = make_cleanup (xfree, linebuffer);
|
old_cleanups = make_cleanup (xfree, linebuffer);
|
||||||
fputs_maybe_filtered (linebuffer, stream, filter);
|
fputs_maybe_filtered (linebuffer, stream, filter);
|
||||||
do_cleanups (old_cleanups);
|
do_cleanups (old_cleanups);
|
||||||
@ -2279,7 +2294,7 @@ vfprintf_unfiltered (struct ui_file *stream, const char *format, va_list args)
|
|||||||
char *linebuffer;
|
char *linebuffer;
|
||||||
struct cleanup *old_cleanups;
|
struct cleanup *old_cleanups;
|
||||||
|
|
||||||
xvasprintf (&linebuffer, format, args);
|
linebuffer = xstrvprintf (format, args);
|
||||||
old_cleanups = make_cleanup (xfree, linebuffer);
|
old_cleanups = make_cleanup (xfree, linebuffer);
|
||||||
fputs_unfiltered (linebuffer, stream);
|
fputs_unfiltered (linebuffer, stream);
|
||||||
do_cleanups (old_cleanups);
|
do_cleanups (old_cleanups);
|
||||||
|
Reference in New Issue
Block a user