public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Move streq and compare_cstrings to gdbsupport
@ 2022-12-15 19:18 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2022-12-15 19:18 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2e55fbce03a0bbee40032b486fe565bfc2423894

commit 2e55fbce03a0bbee40032b486fe565bfc2423894
Author: Tom Tromey <tromey@adacore.com>
Date:   Wed Dec 14 12:28:32 2022 -0700

    Move streq and compare_cstrings to gdbsupport
    
    It seems to me that streq and compare_cstrings belong near the other
    string utility functions in common-utils.h; and furthermore that streq
    ought to be inlined.  This patch makes this change.
    
    Approved-By: Simon Marchi <simon.marchi@efficios.com>

Diff:
---
 gdb/utils.c               |  8 --------
 gdb/utils.h               | 12 ------------
 gdbsupport/common-utils.h | 16 ++++++++++++++++
 3 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/gdb/utils.c b/gdb/utils.c
index 5c110daa4ae..74917f25ab9 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -3099,14 +3099,6 @@ strcmp_iw_ordered (const char *string1, const char *string2)
     }
 }
 
-/* See utils.h.  */
-
-bool
-streq (const char *lhs, const char *rhs)
-{
-  return !strcmp (lhs, rhs);
-}
-
 \f
 
 static void
diff --git a/gdb/utils.h b/gdb/utils.h
index ad7c94988b7..509361dc429 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -98,18 +98,6 @@ extern int strcmp_iw (const char *string1, const char *string2);
 
 extern int strcmp_iw_ordered (const char *, const char *);
 
-/* Return true if the strings are equal.  */
-
-extern bool streq (const char *, const char *);
-
-/* Compare C strings for std::sort.  */
-
-static inline bool
-compare_cstrings (const char *str1, const char *str2)
-{
-  return strcmp (str1, str2) < 0;
-}
-
 /* Reset the prompt_for_continue clock.  */
 void reset_prompt_for_continue_wait_time (void);
 /* Return the time spent in prompt_for_continue.  */
diff --git a/gdbsupport/common-utils.h b/gdbsupport/common-utils.h
index 8a9448a638b..92d7caaf1ec 100644
--- a/gdbsupport/common-utils.h
+++ b/gdbsupport/common-utils.h
@@ -93,6 +93,22 @@ startswith (gdb::string_view string, gdb::string_view pattern)
 	  && strncmp (string.data (), pattern.data (), pattern.length ()) == 0);
 }
 
+/* Return true if the strings are equal.  */
+
+static inline bool
+streq (const char *lhs, const char *rhs)
+{
+  return strcmp (lhs, rhs) == 0;
+}
+
+/* Compare C strings for std::sort.  */
+
+static inline bool
+compare_cstrings (const char *str1, const char *str2)
+{
+  return strcmp (str1, str2) < 0;
+}
+
 ULONGEST strtoulst (const char *num, const char **trailer, int base);
 
 /* Skip leading whitespace characters in INP, returning an updated

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-15 19:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-15 19:18 [binutils-gdb] Move streq and compare_cstrings to gdbsupport Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).