aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-03-19 17:39:24 +1030
committerAlan Modra <amodra@gmail.com>2021-03-21 23:00:32 +1030
commite93388417c1ecc6d69b155045cabb994cb8687fd (patch)
tree24fa2ed727efd5a1775e4c8b76b8d92a5ae0ea10 /gdbsupport
parent38e41a88457d2fcab42596c5d0183e410868c813 (diff)
downloadfsf-binutils-gdb-e93388417c1ecc6d69b155045cabb994cb8687fd.zip
fsf-binutils-gdb-e93388417c1ecc6d69b155045cabb994cb8687fd.tar.gz
fsf-binutils-gdb-e93388417c1ecc6d69b155045cabb994cb8687fd.tar.bz2
Provide an inline startswith function in bfd.h
bfd/ * bfd-in.h (startswith): New inline. (CONST_STRNEQ): Use startswith. * bfd-in2.h: Regenerate. gdbsupport/ * common-utils.h (startswith): Delete version now supplied by bfd.h. libctf/ * ctf-impl.h: Include string.h.
Diffstat (limited to 'gdbsupport')
-rw-r--r--gdbsupport/ChangeLog4
-rw-r--r--gdbsupport/common-utils.h12
2 files changed, 6 insertions, 10 deletions
diff --git a/gdbsupport/ChangeLog b/gdbsupport/ChangeLog
index c8fa9e7..a838cfc 100644
--- a/gdbsupport/ChangeLog
+++ b/gdbsupport/ChangeLog
@@ -1,3 +1,7 @@
+2021-03-21 Alan Modra <amodra@gmail.com>
+
+ * common-utils.h (startswith): Delete version now supplied by bfd.h.
+
2021-02-05 Paul E. Murphy <murphy@linux.ibm.com>
* common-defs.h (ATTRIBUTE_PRINTF): Rename
diff --git a/gdbsupport/common-utils.h b/gdbsupport/common-utils.h
index 28c08ee..1de747f 100644
--- a/gdbsupport/common-utils.h
+++ b/gdbsupport/common-utils.h
@@ -116,16 +116,8 @@ std::string extract_string_maybe_quoted (const char **arg);
extern const char *safe_strerror (int);
-/* Return true if the start of STRING matches PATTERN, false otherwise. */
-
-static inline bool
-startswith (const char *string, const char *pattern)
-{
- return strncmp (string, pattern, strlen (pattern)) == 0;
-}
-
-/* Version of startswith that takes string_view arguments. See comment
- above. */
+/* Version of startswith that takes string_view arguments. Return
+ true if the start of STRING matches PATTERN, false otherwise. */
static inline bool
startswith (gdb::string_view string, gdb::string_view pattern)