This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Use IDENTIFIER_LENGTH instead of strlen(IDENTIFIER_POINTER) in a few places
- From: Steven Bosscher <stevenb dot gcc at gmail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 18 Jun 2012 17:55:03 +0200
- Subject: [patch] Use IDENTIFIER_LENGTH instead of strlen(IDENTIFIER_POINTER) in a few places
Hello,
Obvious enough that I'll commit this a week or so from now, unless
someone objects.
Ciao!
Steven
gcc/
* tree-emultls.c (prefix_name): Use IDENTIFIER_LENGTH instead of
strlen(IDENTIFIER_POINTER).
objc/
* objc-encoding.c (encode_aggregate_fields): Use IDENTIFIER_LENGTH
instead of strlen(IDENTIFIER_POINTER).
(encode_aggregate_within): Likewise.
Index: tree-emutls.c
===================================================================
--- tree-emutls.c (revision 188724)
+++ tree-emutls.c (working copy)
@@ -83,7 +83,7 @@ static tree
prefix_name (const char *prefix, tree name)
{
unsigned plen = strlen (prefix);
- unsigned nlen = strlen (IDENTIFIER_POINTER (name));
+ unsigned nlen = IDENTIFIER_LENGTH (name);
char *toname = (char *) alloca (plen + nlen + 1);
memcpy (toname, prefix, plen);
Index: objc/objc-encoding.c
===================================================================
--- objc/objc-encoding.c (revision 188724)
+++ objc/objc-encoding.c (working copy)
@@ -471,7 +471,7 @@ encode_aggregate_fields (tree type, bool pointed_t
if (fname && TREE_CODE (fname) == IDENTIFIER_NODE)
obstack_grow (&util_obstack,
IDENTIFIER_POINTER (fname),
- strlen (IDENTIFIER_POINTER (fname)));
+ IDENTIFIER_LENGTH (fname));
obstack_1grow (&util_obstack, '"');
}
@@ -561,7 +561,7 @@ encode_aggregate_within (tree type, int curtype, i
if (name && TREE_CODE (name) == IDENTIFIER_NODE)
obstack_grow (&util_obstack,
IDENTIFIER_POINTER (name),
- strlen (IDENTIFIER_POINTER (name)));
+ IDENTIFIER_LENGTH (name));
#endif
else
obstack_1grow (&util_obstack, '?');