mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-18 00:32:30 +08:00
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>
This commit is contained in:
@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
12
gdb/utils.h
12
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 *);
|
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. */
|
/* Reset the prompt_for_continue clock. */
|
||||||
void reset_prompt_for_continue_wait_time (void);
|
void reset_prompt_for_continue_wait_time (void);
|
||||||
/* Return the time spent in prompt_for_continue. */
|
/* Return the time spent in prompt_for_continue. */
|
||||||
|
@ -93,6 +93,22 @@ startswith (gdb::string_view string, gdb::string_view pattern)
|
|||||||
&& strncmp (string.data (), pattern.data (), pattern.length ()) == 0);
|
&& 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);
|
ULONGEST strtoulst (const char *num, const char **trailer, int base);
|
||||||
|
|
||||||
/* Skip leading whitespace characters in INP, returning an updated
|
/* Skip leading whitespace characters in INP, returning an updated
|
||||||
|
Reference in New Issue
Block a user