aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2010-05-07 14:01:55 +0000
committerPedro Alves <palves@redhat.com>2010-05-07 14:01:55 +0000
commit94b0dee14131cfc1d6aef4690eab720e117f44e7 (patch)
treee20cd09178b74cee6f48f6c4e7130c5a92dc4940 /gdb/remote.c
parent1408c251017cb8f0ffe27cbc69ffbed385d408da (diff)
downloadgdb-94b0dee14131cfc1d6aef4690eab720e117f44e7.zip
gdb-94b0dee14131cfc1d6aef4690eab720e117f44e7.tar.gz
gdb-94b0dee14131cfc1d6aef4690eab720e117f44e7.tar.bz2
* remote.c (remote_query_supported_append): Use reconcat.
(remote_query_supported): Install a cleanup. Use reconcat.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r--gdb/remote.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index 3da591f..40e1460 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -3523,9 +3523,9 @@ register_remote_support_xml (const char *xml)
while ((p = strtok (NULL, ",")) != NULL);
xfree (copy);
- p = concat (remote_support_xml, ",", xml, (char *) NULL);
- xfree (remote_support_xml);
- remote_support_xml = p;
+ remote_support_xml = reconcat (remote_support_xml,
+ remote_support_xml, ",", xml,
+ (char *) NULL);
}
#endif
}
@@ -3534,11 +3534,7 @@ static char *
remote_query_supported_append (char *msg, const char *append)
{
if (msg)
- {
- char *p = concat (msg, ";", append, (char *) NULL);
- xfree (msg);
- return p;
- }
+ return reconcat (msg, msg, ";", append, (char *) NULL);
else
return xstrdup (append);
}
@@ -3562,6 +3558,7 @@ remote_query_supported (void)
if (remote_protocol_packets[PACKET_qSupported].support != PACKET_DISABLE)
{
char *q = NULL;
+ struct cleanup *old_chain = make_cleanup (free_current_contents, &q);
if (rs->extended)
q = remote_query_supported_append (q, "multiprocess+");
@@ -3571,14 +3568,14 @@ remote_query_supported (void)
if (q)
{
- char *p = concat ("qSupported:", q, (char *) NULL);
- xfree (q);
- putpkt (p);
- xfree (p);
+ q = reconcat (q, "qSupported:", q, (char *) NULL);
+ putpkt (q);
}
else
putpkt ("qSupported");
+ do_cleanups (old_chain);
+
getpkt (&rs->buf, &rs->buf_size, 0);
/* If an error occured, warn, but do not return - just reset the