This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Use obstack_grow_str


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bc491f2e76df1f2cec877eb07e88209b609ddecf

commit bc491f2e76df1f2cec877eb07e88209b609ddecf
Author: Yao Qi <yao.qi@linaro.org>
Date:   Wed Jun 28 14:48:55 2017 +0100

    Use obstack_grow_str
    
    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.

Diff:
---
 gdb/ChangeLog         | 5 +++++
 gdb/mi/mi-cmd-break.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ae79dc6..d110c34 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
index 9412af8..560174e 100644
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -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');


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]