This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 03/10] Make target_desc::features an std::vector


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 (齐尧)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]