+2019-10-28 Christian Biesinger <cbiesinger@google.com>
+
+ * gdbsupport/common-utils.h (startswith): Add an overloaded version
+ that takes gdb::string_view arguments.
+
2019-10-26 Tom de Vries <tdevries@suse.de>
* aarch64-linux-tdep.c: Fix typos in comments.
#endif
#endif
+#include "gdb_string_view.h"
+
/* xmalloc(), xrealloc() and xcalloc() have already been declared in
"libiberty.h". */
return strncmp (string, pattern, strlen (pattern)) == 0;
}
+/* Version of startswith that takes string_view arguments. See comment
+ above. */
+
+static inline bool
+startswith (gdb::string_view string, gdb::string_view pattern)
+{
+ return (string.length () >= pattern.length ()
+ && strncmp (string.data (), pattern.data (), pattern.length ()) == 0);
+}
+
ULONGEST strtoulst (const char *num, const char **trailer, int base);
/* Skip leading whitespace characters in INP, returning an updated