Patchwork Use IDENTIFIER_LENGTH instead of strlen(IDENTIFIER_POINTER) in a few places

login
register
mail settings
Submitter Steven Bosscher
Date June 18, 2012, 3:55 p.m.
Message ID <CABu31nORyMZ_QrM-JetwtUWcs7PjVudvUObu7=SL-0P0aQvzRQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/165499/
State New
Headers show

Comments

Steven Bosscher - June 18, 2012, 3:55 p.m.
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.
Mike Stump - June 19, 2012, 8:45 p.m.
On Jun 18, 2012, at 8:55 AM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> Obvious enough
> 
> objc/
>        * objc-encoding.c (encode_aggregate_fields): Use IDENTIFIER_LENGTH
>        instead of strlen(IDENTIFIER_POINTER).
>        (encode_aggregate_within): Likewise.

Ok.

Patch

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, '?');