aboutsummaryrefslogtreecommitdiff
path: root/gdb/gnu-v2-abi.c
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2015-03-06 09:42:06 +0000
committerGary Benson <gbenson@redhat.com>2015-03-06 09:42:06 +0000
commit61012eef8463764ccd9117dc1c9bc43cc452b7cc (patch)
treef576a77bcb77e71cc60e6592b56d2aa915b50c36 /gdb/gnu-v2-abi.c
parente80417caef36c7d5e3d1da6a3b396a872d9d7201 (diff)
downloadgdb-61012eef8463764ccd9117dc1c9bc43cc452b7cc.zip
gdb-61012eef8463764ccd9117dc1c9bc43cc452b7cc.tar.gz
gdb-61012eef8463764ccd9117dc1c9bc43cc452b7cc.tar.bz2
New common function "startswith"
This commit introduces a new inline common function "startswith" which takes two string arguments and returns nonzero if the first string starts with the second. It also updates the 295 places where this logic was written out longhand to use the new function. gdb/ChangeLog: * common/common-utils.h (startswith): New inline function. All places where this logic was used updated to use the above.
Diffstat (limited to 'gdb/gnu-v2-abi.c')
-rw-r--r--gdb/gnu-v2-abi.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c
index 5389374..68b734c 100644
--- a/gdb/gnu-v2-abi.c
+++ b/gdb/gnu-v2-abi.c
@@ -37,7 +37,7 @@ static enum dtor_kinds
gnuv2_is_destructor_name (const char *name)
{
if ((name[0] == '_' && is_cplus_marker (name[1]) && name[2] == '_')
- || strncmp (name, "__dt__", 6) == 0)
+ || startswith (name, "__dt__"))
return complete_object_dtor;
else
return 0;
@@ -48,7 +48,7 @@ gnuv2_is_constructor_name (const char *name)
{
if ((name[0] == '_' && name[1] == '_'
&& (isdigit (name[2]) || strchr ("Qt", name[2])))
- || strncmp (name, "__ct__", 6) == 0)
+ || startswith (name, "__ct__"))
return complete_object_ctor;
else
return 0;
@@ -68,7 +68,7 @@ gnuv2_is_vtable_name (const char *name)
static int
gnuv2_is_operator_name (const char *name)
{
- return strncmp (name, "operator", 8) == 0;
+ return startswith (name, "operator");
}