aboutsummaryrefslogtreecommitdiff
path: root/gdb/cp-support.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-07-17 15:51:55 +0100
committerPedro Alves <palves@redhat.com>2017-07-17 15:51:55 +0100
commit8090b426b57bd9ebfa4c593ba3e6f939b2911739 (patch)
tree76234c2ece65a1b19b697e0352adfdae343638c0 /gdb/cp-support.c
parent6a2c1b8790e58ce0688507b5b1f8369aa621a665 (diff)
downloadgdb-8090b426b57bd9ebfa4c593ba3e6f939b2911739.zip
gdb-8090b426b57bd9ebfa4c593ba3e6f939b2911739.tar.gz
gdb-8090b426b57bd9ebfa4c593ba3e6f939b2911739.tar.bz2
Introduce CP_OPERATOR_STR/CP_OPERATOR_LEN and use throughout
Move LENGTH_OF_OPERATOR from cp-support.c to cp-support.h so we can use it elsewhere. Since there's already CP_ANONYMOUS_NAMESPACE_STR/CP_ANONYMOUS_NAMESPACE_LEN there, follow the same naming pattern for the new symbols. gdb/ChangeLog: 2017-07-17 Pedro Alves <palves@redhat.com> * c-exp.y (operator_stoken): Use CP_OPERATOR_LEN and CP_OPERATOR_STR. * c-typeprint.c (is_type_conversion_operator): Use CP_OPERATOR_STR. * cp-support.c (LENGTH_OF_OPERATOR): Delete. (cp_find_first_component_aux): Use CP_OPERATOR_STR and CP_OPERATOR_LEN. * cp-support.h (CP_OPERATOR_STR, CP_OPERATOR_LEN): New. * gnu-v2-abi.c (gnuv2_is_operator_name): Use CP_OPERATOR_STR. * gnu-v3-abi.c (gnuv3_is_operator_name): Use CP_OPERATOR_STR. * linespec.c (linespec_lexer_lex_string): Use CP_OPERATOR_LEN and CP_OPERATOR_STR. * location.c: Include "cp-support.h". (explicit_location_lex_one): Use CP_OPERATOR_LEN and CP_OPERATOR_STR. * symtab.c (operator_chars): Use CP_OPERATOR_STR and CP_OPERATOR_LEN.
Diffstat (limited to 'gdb/cp-support.c')
-rw-r--r--gdb/cp-support.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 5704466..122fadd 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -931,10 +931,6 @@ cp_find_first_component (const char *name)
the recursion easier, it also stops if it reaches an unexpected ')'
or '>' if the value of PERMISSIVE is nonzero. */
-/* Let's optimize away calls to strlen("operator"). */
-
-#define LENGTH_OF_OPERATOR 8
-
static unsigned int
cp_find_first_component_aux (const char *name, int permissive)
{
@@ -1006,10 +1002,9 @@ cp_find_first_component_aux (const char *name, int permissive)
case 'o':
/* Operator names can screw up the recursion. */
if (operator_possible
- && strncmp (name + index, "operator",
- LENGTH_OF_OPERATOR) == 0)
+ && startswith (name + index, CP_OPERATOR_STR))
{
- index += LENGTH_OF_OPERATOR;
+ index += CP_OPERATOR_LEN;
while (ISSPACE(name[index]))
++index;
switch (name[index])