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: [RFA 23/23] Use gdb_argv_up in Python


On 05/03/2017 11:46 PM, Tom Tromey wrote:
> This changes one spot in the Python code to use gdb_argv_up.  This
> removes the last cleanup from the Python layer.

Hurray!  Thanks so much for all this work.

> -      self->enumeration[i]
> -	= python_string_to_host_string (item.get ()).release ();
> +      enumeration[i] = python_string_to_host_string (item.get ()).release ();
>        if (self->enumeration[i] == NULL)

I think you need to adjust the if too:

       if (enumeration[i] == NULL)


> -	{
> -	  do_cleanups (back_to);
> -	  return 0;
> -	}
> -      make_cleanup (xfree, (char *) self->enumeration[i]);
> +	return 0;
>      }
>  
> -  discard_cleanups (back_to);
> +  self->enumeration = const_cast<const char**> (enumeration.release ());
>    return 1;

If I'm reading the code correctly, "self->enumeration" is never 
released (by design), right?

Thanks,
Pedro Alves


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