Remove a cleanup from parse_expression_for_completion

This removes a cleanup from parse_expression_for_completion, by
changing various expression-completion functions to use
gdb::unique_xmalloc_ptry rather than explicit malloc+free.

Regression tested by the buildbot.

gdb/ChangeLog
2018-02-21  Tom Tromey  <tom@tromey.com>

	* value.h: (extract_field_op): Update.
	* eval.c (extract_field_op): Return a const char *.
	* expression.h (parse_expression_for_completion): Update.
	* completer.c (complete_expression): Update.
	(add_struct_fields): Make fieldname const.
	* parse.c (expout_completion_name): Now a unique_xmalloc_ptr.
	(mark_completion_tag, parse_exp_in_context_1): Update.
	(parse_expression_for_completion): Change "name" to
	unique_xmalloc_ptr*.
This commit is contained in:
Tom Tromey
2018-02-15 22:41:03 -07:00
parent 6ccb583f75
commit 3eac2b6548
6 changed files with 38 additions and 34 deletions

View File

@@ -101,8 +101,8 @@ extern expression_up parse_expression (const char *);
extern expression_up parse_expression_with_language (const char *string,
enum language lang);
extern struct type *parse_expression_for_completion (const char *, char **,
enum type_code *);
extern struct type *parse_expression_for_completion
(const char *, gdb::unique_xmalloc_ptr<char> *, enum type_code *);
extern expression_up parse_exp_1 (const char **, CORE_ADDR pc,
const struct block *, int);