This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils 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] bfin: simplify current_inputline


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

commit e1ec8109ab32b653c860193798bb13a779e867f5
Author: Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
Date:   Sat Apr 2 08:22:05 2016 -0400

    bfin: simplify current_inputline
    
    Its not used for anything outside of md_assemble () so it doesn't need to be
    extern.  While we are there we can replace free () and xmalloc () with
    XRESIZEVEC which should be faster.
    
    gas/ChangeLog:
    
    2016-04-03  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
    
    	* config/bfin-parse.y (current_inputline): Remove definition.
    	* config/tc-bfin.c (md_assemble): Simplify use of current_inputline.

Diff:
---
 gas/ChangeLog           | 5 +++++
 gas/config/bfin-parse.y | 1 -
 gas/config/tc-bfin.c    | 6 ++----
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 8d6ba9b..d4886c0 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,10 @@
 2016-04-03  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
 
+	* config/bfin-parse.y (current_inputline): Remove definition.
+	* config/tc-bfin.c (md_assemble): Simplify use of current_inputline.
+
+2016-04-03  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
+
 	* config/tc-avr.c (md_parse_option): Use strcasecmp () to compare
 	strings.
 
diff --git a/gas/config/bfin-parse.y b/gas/config/bfin-parse.y
index be53280..26070c1 100644
--- a/gas/config/bfin-parse.y
+++ b/gas/config/bfin-parse.y
@@ -160,7 +160,6 @@ static Expr_Node *unary  (Expr_Op_Type, Expr_Node *);
 
 static void notethat (const char *, ...);
 
-char *current_inputline;
 extern char *yytext;
 int yyerror (const char *);
 
diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c
index caa89c6..4f9ad7e 100644
--- a/gas/config/tc-bfin.c
+++ b/gas/config/tc-bfin.c
@@ -485,20 +485,18 @@ void
 md_assemble (char *line)
 {
   char *toP = 0;
-  extern char *current_inputline;
   int size, insn_size;
   struct bfin_insn *tmp_insn;
   size_t len;
   static size_t buffer_len = 0;
+  static char *current_inputline;
   parse_state state;
 
   len = strlen (line);
   if (len + 2 > buffer_len)
     {
-      if (buffer_len > 0)
-	free (current_inputline);
       buffer_len = len + 40;
-      current_inputline = xmalloc (buffer_len);
+      current_inputline = XRESIZEVEC (char, current_inputline, buffer_len);
     }
   memcpy (current_inputline, line, len);
   current_inputline[len] = ';';


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