binutils-gdb/gdb/cli
Pedro Alves 60a20c1907 Factor out final completion match string building
We have several places doing essentially the same thing; factor them
out to a central place.  Some of the places overallocate for no good
reason, or use strcat unnecessarily.  The centralized version is more
precise and to the point.

(I considered making the gdb::unique_xmalloc_ptr overload version of
make_completer_match_str try to realloc (not xrealloc) probably
avoiding an allocation in most cases, but that'd be probably overdoing
it, and also, now that I'm writing this I thought I'd try to see how
could we ever get to filename_completer with "text != word", but I
couldn't figure it out.  Running the testsuite with 'gdb_assert (text
== word);' never tripped on the assertion either.  So post gdb 8.1,
I'll probably propose a patch to simplify filename_completer a bit,
and the gdb::unique_xmalloc_str overload can be removed then.)

gdb/ChangeLog:
2017-12-13  Pedro Alves  <palves@redhat.com>

	* cli/cli-decode.c (complete_on_cmdlist, complete_on_enum): Use
	make_completion_match_str.
	* completer.c: Use gdb::unique_xmalloc_ptr and
	make_completion_match_str.
	(make_completion_match_str_1): New.
	(make_completion_match_str(const char *, const char *,
	const char *)): New.
	(make_completion_match_str(gdb::unique_xmalloc_ptr<char> &&,
	const char *, const char *)): New.
	* completer.h (make_completion_match_str(const char *,
	const char *, const char *)): New.
	(make_completion_match_str(gdb::unique_xmalloc_ptr<char> &&,
	const char *, const char *)): New.
	* interps.c (interpreter_completer): Use make_completion_match_str.
	* symtab.c (completion_list_add_name, add_filename_to_list): Use
	make_completion_match_str.
2017-12-13 16:38:49 +00:00
..
cli-cmds.c Constify add_info 2017-11-07 13:59:09 -07:00
cli-cmds.h Constify add_com 2017-11-07 13:59:09 -07:00
cli-decode.c Factor out final completion match string building 2017-12-13 16:38:49 +00:00
cli-decode.h Constify execute_command 2017-11-07 13:59:09 -07:00
cli-dump.c Remove some unused variables 2017-12-05 16:05:50 -05:00
cli-interp.c Constify execute_command 2017-11-07 13:59:09 -07:00
cli-interp.h C++-fy struct interp/cli_interp/tui_interp/mi_interp 2017-02-03 16:30:04 +00:00
cli-logging.c Constify add_setshow_* 2017-11-07 13:59:09 -07:00
cli-script.c Constify execute_command 2017-11-07 13:59:09 -07:00
cli-script.h Constify execute_command 2017-11-07 13:59:09 -07:00
cli-setshow.c Rename _const functions to use overloading instead 2017-09-11 15:46:12 -06:00
cli-setshow.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
cli-utils.c Make breakpoint/location number parsing error output consistent 2017-11-07 11:07:19 +00:00
cli-utils.h Make extract_arg return a std::string 2017-09-11 15:46:14 -06:00