[RFA 03/23] Use gdb_file_up in find_and_open_script

Tom Tromey tom@tromey.com
Sun Jul 23 16:08:00 GMT 2017


>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

>> -extern int find_and_open_script (const char *file, int search_path,
>> -				 FILE **streamp, char **full_path);
>> +extern gdb_file_up
>> +    find_and_open_script (const char *file, int search_path,
>> +			  gdb::unique_xmalloc_ptr<char> *full_path);
>> 

Pedro> Though I wonder whether using gdb::optional wouldn't look clearer:

Pedro>  /* The script that was opened.  */
Pedro>  struct open_script
Pedro>  {
Pedro>    gdb_file_up stream;
Pedro>    gdb::unique_xmalloc_ptr<char> full_path;
Pedro>  };

[...]

I went ahead and did it this way.

Tom



More information about the Gdb-patches mailing list