On 02/12/2016 11:12 AM, David Malcolm wrote:


The problem is that struct spec_list's "name" field is declared const:

   const char *name;            /* name of the spec.  */

and likewise for the "name" field within struct spec_list_1:

   const char *const name;

Some are statically allocated, others are dynamically allocated.

If I convert them to:

   char *name;          /* name of the spec.  */

and:

   char *const name;
I'm not suggesting you remove the const for thees things.

It seems simpler to keep the "const" on those string fields, and cast
it away when cleaning up the dynamically-allocated ones (as in the
candidate patch).
Is it really necessary to cast it away to call free?  I suppose it is.

OK without the twiddle.

jeff

Reply via email to