This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 5/6] Return unique_xmalloc_ptr from target_read_stralloc
- From: Simon Marchi <simon dot marchi at ericsson dot com>
- To: Tom Tromey <tom at tromey dot com>, <gdb-patches at sourceware dot org>
- Date: Mon, 16 Oct 2017 17:02:23 -0400
- Subject: Re: [RFA 5/6] Return unique_xmalloc_ptr from target_read_stralloc
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=simon dot marchi at ericsson dot com;
- References: <20171016030427.21349-1-tom@tromey.com> <20171016030427.21349-6-tom@tromey.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 2017-10-15 11:04 PM, Tom Tromey wrote:
> diff --git a/gdb/target.h b/gdb/target.h
> index 581c89be54..98bcd789e0 100644
> --- a/gdb/target.h
> +++ b/gdb/target.h
> @@ -358,9 +358,8 @@ extern LONGEST target_read_alloc (struct target_ops *ops,
> are returned as allocated but empty strings. A warning is issued
> if the result contains any embedded NUL bytes. */
>
> -extern char *target_read_stralloc (struct target_ops *ops,
> - enum target_object object,
> - const char *annex);
> +extern gdb::unique_xmalloc_ptr<char> target_read_stralloc
> + (struct target_ops *ops, enum target_object object, const char *annex);
You changed the comment above target_read_stralloc in target.c. Can you put
/* See target.h. */
and update this one instead?
>
> /* See target_ops->to_xfer_partial. */
> extern target_xfer_partial_ftype target_xfer_partial;
> @@ -2401,7 +2400,7 @@ struct target_ops *find_target_at (enum strata stratum);
> unsupported, NULL is returned. Empty objects are returned as
> allocated but empty strings. */
>
> -extern char *target_get_osdata (const char *type);
> +extern gdb::unique_xmalloc_ptr<char> target_get_osdata (const char *type);
You can update the comment of this function in the same way, and add "See target.h"
in target.c.
>
>
> /* Stuff that should be shared among the various remote targets. */
> diff --git a/gdb/xml-support.c b/gdb/xml-support.c
> index 50a062a3a4..7cecaa8d4d 100644
> --- a/gdb/xml-support.c
> +++ b/gdb/xml-support.c
> @@ -808,8 +808,7 @@ xinclude_start_include (struct gdb_xml_parser *parser,
> struct xinclude_parsing_data *data
> = (struct xinclude_parsing_data *) user_data;
> char *href = (char *) xml_find_attribute (attributes, "href")->value;
> - struct cleanup *back_to;
> - char *text, *output;
> + char *output;
You can remove output too.
LGTM with those fixed.
Simon