Commit 88c08b06 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

cmd/internal: C->Go printf cleanup

Change-Id: I1cf94377c613fb51ae77f4fe1e3439268b1606a9
Reviewed-on: https://go-review.googlesource.com/9161Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 899a4ad4
...@@ -2424,16 +2424,13 @@ var lexn = []struct { ...@@ -2424,16 +2424,13 @@ var lexn = []struct {
{LVAR, "VAR"}, {LVAR, "VAR"},
} }
var lexname_buf string
func lexname(lex int) string { func lexname(lex int) string {
for i := 0; i < len(lexn); i++ { for i := 0; i < len(lexn); i++ {
if lexn[i].lex == lex { if lexn[i].lex == lex {
return lexn[i].name return lexn[i].name
} }
} }
lexname_buf = fmt.Sprintf("LEX-%d", lex) return fmt.Sprintf("LEX-%d", lex)
return lexname_buf
} }
var yytfix = []struct { var yytfix = []struct {
......
...@@ -75,8 +75,6 @@ var _typekind = []string{ ...@@ -75,8 +75,6 @@ var _typekind = []string{
TIDEAL: "untyped number", TIDEAL: "untyped number",
} }
var typekind_buf string
func typekind(t *Type) string { func typekind(t *Type) string {
if Isslice(t) { if Isslice(t) {
return "slice" return "slice"
...@@ -88,8 +86,7 @@ func typekind(t *Type) string { ...@@ -88,8 +86,7 @@ func typekind(t *Type) string {
return s return s
} }
} }
typekind_buf = fmt.Sprintf("etype=%d", et) return fmt.Sprintf("etype=%d", et)
return typekind_buf
} }
/* /*
......
...@@ -33,10 +33,10 @@ package ld ...@@ -33,10 +33,10 @@ package ld
import ( import (
"cmd/internal/obj" "cmd/internal/obj"
"fmt"
"log" "log"
"os" "os"
"path/filepath" "path/filepath"
"strconv"
) )
func yy_isalpha(c int) bool { func yy_isalpha(c int) bool {
...@@ -208,16 +208,13 @@ func Linkrlookup(ctxt *Link, name string, v int) *LSym { ...@@ -208,16 +208,13 @@ func Linkrlookup(ctxt *Link, name string, v int) *LSym {
return _lookup(ctxt, name, v, 0) return _lookup(ctxt, name, v, 0)
} }
var headstr_buf string
func Headstr(v int) string { func Headstr(v int) string {
for i := 0; i < len(headers); i++ { for i := 0; i < len(headers); i++ {
if v == headers[i].val { if v == headers[i].val {
return headers[i].name return headers[i].name
} }
} }
headstr_buf = fmt.Sprintf("%d", v) return strconv.Itoa(v)
return headstr_buf
} }
func headtype(name string) int { func headtype(name string) int {
......
...@@ -93,7 +93,7 @@ func (i *int32Value) Set(s string) error { ...@@ -93,7 +93,7 @@ func (i *int32Value) Set(s string) error {
func (i *int32Value) Get() interface{} { return int32(*i) } func (i *int32Value) Get() interface{} { return int32(*i) }
func (i *int32Value) String() string { return fmt.Sprintf("%v", *i) } func (i *int32Value) String() string { return fmt.Sprint(*i) }
type fn0 func() type fn0 func()
......
...@@ -379,7 +379,7 @@ func Dconv(p *Prog, a *Addr) string { ...@@ -379,7 +379,7 @@ func Dconv(p *Prog, a *Addr) string {
break break
} }
str = fmt.Sprintf("%v", Rconv(int(a.Reg))) str = Rconv(int(a.Reg))
if a.Name != TYPE_NONE || a.Sym != nil { if a.Name != TYPE_NONE || a.Sym != nil {
str = fmt.Sprintf("%v(%v)(REG)", Mconv(a), Rconv(int(a.Reg))) str = fmt.Sprintf("%v(%v)(REG)", Mconv(a), Rconv(int(a.Reg)))
} }
...@@ -388,9 +388,9 @@ func Dconv(p *Prog, a *Addr) string { ...@@ -388,9 +388,9 @@ func Dconv(p *Prog, a *Addr) string {
if a.Sym != nil { if a.Sym != nil {
str = fmt.Sprintf("%s(SB)", a.Sym.Name) str = fmt.Sprintf("%s(SB)", a.Sym.Name)
} else if p != nil && p.Pcond != nil { } else if p != nil && p.Pcond != nil {
str = fmt.Sprintf("%d", p.Pcond.Pc) str = fmt.Sprint(p.Pcond.Pc)
} else if a.Val != nil { } else if a.Val != nil {
str = fmt.Sprintf("%d", a.Val.(*Prog).Pc) str = fmt.Sprint(a.Val.(*Prog).Pc)
} else { } else {
str = fmt.Sprintf("%d(PC)", a.Offset) str = fmt.Sprintf("%d(PC)", a.Offset)
} }
...@@ -467,7 +467,7 @@ func Mconv(a *Addr) string { ...@@ -467,7 +467,7 @@ func Mconv(a *Addr) string {
case NAME_NONE: case NAME_NONE:
switch { switch {
case a.Reg == REG_NONE: case a.Reg == REG_NONE:
str = fmt.Sprintf("%d", a.Offset) str = fmt.Sprint(a.Offset)
case a.Offset == 0: case a.Offset == 0:
str = fmt.Sprintf("(%v)", Rconv(int(a.Reg))) str = fmt.Sprintf("(%v)", Rconv(int(a.Reg)))
case a.Offset != 0: case a.Offset != 0:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment