]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove subset_compare
authorTom Tromey <tromey@adacore.com>
Wed, 14 Dec 2022 19:22:58 +0000 (12:22 -0700)
committerTom Tromey <tromey@adacore.com>
Thu, 15 Dec 2022 19:13:29 +0000 (12:13 -0700)
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>
gdb/stack.c
gdb/tui/tui-win.c
gdb/utils.c
gdb/utils.h

index 4ad51c2eb50ec539ca7a3f06ab260e32f6494cae..c7d392842ae18edf5f715d7d952f55159b17bebf 100644 (file)
@@ -2140,17 +2140,17 @@ parse_backtrace_qualifiers (const char *arg,
       if (this_arg.empty ())
        return arg;
 
-      if (subset_compare (this_arg.c_str (), "no-filters"))
+      if (startswith ("no-filters", this_arg))
        {
          if (bt_cmd_opts != nullptr)
            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)
            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)
            bt_cmd_opts->hide = true;
index e24763c0072d879b8489ea1bfd52615403373b74..bad8ffe0972f2d37934aa813869a36adad673e1a 100644 (file)
@@ -711,9 +711,9 @@ tui_set_focus_command (const char *arg, int from_tty)
 
   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 ());
-  else if (subset_compare (arg, "prev"))
+  else if (startswith ("prev", arg))
     win_info = tui_prev_win (tui_win_with_focus ());
   else
     win_info = tui_partial_win_by_name (arg);
index c37d9add500d71bf2e742683612228bc51acd010..5c110daa4aeb0b4ff2f0a7b43ce0eb66fb438e64 100644 (file)
@@ -3109,26 +3109,6 @@ streq (const char *lhs, const char *rhs)
 
 \f
 
-/*
-   ** 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
 show_debug_timestamp (struct ui_file *file, int from_tty,
                      struct cmd_list_element *c, const char *value)
index d2acf899ba280527ee13f9f478a9f7b2cb467620..ad7c94988b770ec47ab8f2374240e3e13295e7d2 100644 (file)
@@ -102,8 +102,6 @@ extern int strcmp_iw_ordered (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.  */
 
 static inline bool