mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-18 08:38:10 +08:00
Remove subset_compare
I stumbled across subset_compare today, and after looking at the callers I realized it could be removed and replaced with calls to startswith. Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
@ -2140,17 +2140,17 @@ parse_backtrace_qualifiers (const char *arg,
|
|||||||
if (this_arg.empty ())
|
if (this_arg.empty ())
|
||||||
return arg;
|
return arg;
|
||||||
|
|
||||||
if (subset_compare (this_arg.c_str (), "no-filters"))
|
if (startswith ("no-filters", this_arg))
|
||||||
{
|
{
|
||||||
if (bt_cmd_opts != nullptr)
|
if (bt_cmd_opts != nullptr)
|
||||||
bt_cmd_opts->no_filters = true;
|
bt_cmd_opts->no_filters = true;
|
||||||
}
|
}
|
||||||
else if (subset_compare (this_arg.c_str (), "full"))
|
else if (startswith ("full", this_arg))
|
||||||
{
|
{
|
||||||
if (bt_cmd_opts != nullptr)
|
if (bt_cmd_opts != nullptr)
|
||||||
bt_cmd_opts->full = true;
|
bt_cmd_opts->full = true;
|
||||||
}
|
}
|
||||||
else if (subset_compare (this_arg.c_str (), "hide"))
|
else if (startswith ("hide", this_arg))
|
||||||
{
|
{
|
||||||
if (bt_cmd_opts != nullptr)
|
if (bt_cmd_opts != nullptr)
|
||||||
bt_cmd_opts->hide = true;
|
bt_cmd_opts->hide = true;
|
||||||
|
@ -711,9 +711,9 @@ tui_set_focus_command (const char *arg, int from_tty)
|
|||||||
|
|
||||||
struct tui_win_info *win_info = NULL;
|
struct tui_win_info *win_info = NULL;
|
||||||
|
|
||||||
if (subset_compare (arg, "next"))
|
if (startswith ("next", arg))
|
||||||
win_info = tui_next_win (tui_win_with_focus ());
|
win_info = tui_next_win (tui_win_with_focus ());
|
||||||
else if (subset_compare (arg, "prev"))
|
else if (startswith ("prev", arg))
|
||||||
win_info = tui_prev_win (tui_win_with_focus ());
|
win_info = tui_prev_win (tui_win_with_focus ());
|
||||||
else
|
else
|
||||||
win_info = tui_partial_win_by_name (arg);
|
win_info = tui_partial_win_by_name (arg);
|
||||||
|
20
gdb/utils.c
20
gdb/utils.c
@ -3109,26 +3109,6 @@ streq (const char *lhs, const char *rhs)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
** subset_compare()
|
|
||||||
** Answer whether string_to_compare is a full or partial match to
|
|
||||||
** template_string. The partial match must be in sequence starting
|
|
||||||
** at index 0.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
subset_compare (const char *string_to_compare, const char *template_string)
|
|
||||||
{
|
|
||||||
int match;
|
|
||||||
|
|
||||||
if (template_string != NULL && string_to_compare != NULL
|
|
||||||
&& strlen (string_to_compare) <= strlen (template_string))
|
|
||||||
match =
|
|
||||||
(startswith (template_string, string_to_compare));
|
|
||||||
else
|
|
||||||
match = 0;
|
|
||||||
return match;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_debug_timestamp (struct ui_file *file, int from_tty,
|
show_debug_timestamp (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c, const char *value)
|
struct cmd_list_element *c, const char *value)
|
||||||
|
@ -102,8 +102,6 @@ extern int strcmp_iw_ordered (const char *, const char *);
|
|||||||
|
|
||||||
extern bool streq (const char *, const char *);
|
extern bool streq (const char *, const char *);
|
||||||
|
|
||||||
extern int subset_compare (const char *, const char *);
|
|
||||||
|
|
||||||
/* Compare C strings for std::sort. */
|
/* Compare C strings for std::sort. */
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
|
Reference in New Issue
Block a user