Use obstack_grow_str
authorYao Qi <yao.qi@linaro.org>
Wed, 28 Jun 2017 13:48:55 +0000 (14:48 +0100)
committerYao Qi <yao.qi@linaro.org>
Wed, 28 Jun 2017 14:00:27 +0000 (15:00 +0100)
We already have macro obstack_grow_str, which is helpful to shorten the
code.

gdb:

2017-06-28  Yao Qi  <yao.qi@linaro.org>

* mi/mi-cmd-break.c (mi_argv_to_format): Use obstack_grow_str
instead of obstack_grow.

gdb/ChangeLog
gdb/mi/mi-cmd-break.c

index ae79dc681dfee57ca47c4c17fc760bb2a1bcb530..d110c34f2d200408c1061b39f1ac559b9a8ca423 100644 (file)
@@ -1,3 +1,8 @@
+2017-06-28  Yao Qi  <yao.qi@linaro.org>
+
+       * mi/mi-cmd-break.c (mi_argv_to_format): Use obstack_grow_str
+       instead of obstack_grow.
+
 2017-06-28  Doug Gilmore  <Doug.Gilmore@imgtec.com>
 
        PR gdb/21337
index 9412af8e14b8d2dc58c92760e4c18ab75ee8699c..560174eaa85f18f2b6eaebe8a5543802760a5ce8 100644 (file)
@@ -141,7 +141,7 @@ mi_argv_to_format (char **argv, int argc)
 
              xsnprintf (tmp, sizeof (tmp), "\\%o",
                         (unsigned char) argv[0][i]);
-             obstack_grow (&obstack, tmp, strlen (tmp));
+             obstack_grow_str (&obstack, tmp);
            }
          break;
        }
@@ -152,7 +152,7 @@ mi_argv_to_format (char **argv, int argc)
   for (i = 1; i < argc; i++)
     {
       obstack_1grow (&obstack, ',');
-      obstack_grow (&obstack, argv[i], strlen (argv[i]));
+      obstack_grow_str (&obstack, argv[i]);
     }
   obstack_1grow (&obstack, '\0');