This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 03/10] Make target_desc::features an std::vector
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Simon Marchi <simon dot marchi at ericsson dot com>
- Cc: <gdb-patches at sourceware dot org>, Simon Marchi <simon dot marchi at polymtl dot ca>
- Date: Thu, 02 Nov 2017 09:29:34 +0000
- Subject: Re: [PATCH 03/10] Make target_desc::features an std::vector
- Authentication-results: sourceware.org; auth=none
- References: <1509414120-14659-1-git-send-email-simon.marchi@ericsson.com> <1509414120-14659-4-git-send-email-simon.marchi@ericsson.com>
Simon Marchi <simon.marchi@ericsson.com> writes:
Patch is good to me, two comments below,
> +typedef std::unique_ptr<tdesc_feature> tdesc_feature_up;
>
> /* A target description. */
>
> @@ -393,17 +394,7 @@ struct target_desc : tdesc_element
> target_desc ()
> {}
>
> - virtual ~target_desc ()
> - {
> - struct tdesc_feature *feature;
> - int ix;
> -
> - for (ix = 0;
> - VEC_iterate (tdesc_feature_p, features, ix, feature);
> - ix++)
> - delete feature;
> - VEC_free (tdesc_feature_p, features);
> - }
> + virtual ~target_desc () = default;
>
Can't we remove this line and use default (compiler generated)
dtor?
> target_desc (const target_desc &) = delete;
> void operator= (const target_desc &) = delete;
> @@ -422,17 +413,13 @@ struct target_desc : tdesc_element
> std::vector<property> properties;
>
> /* The features associated with this target. */
> - VEC(tdesc_feature_p) *features = NULL;
> + std::vector<std::unique_ptr<tdesc_feature>> features;
>
std::vector<tdesc_feature_up> features;
shorten the code.
--
Yao (齐尧)