Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
7732d80c
Commit
7732d80c
authored
Nov 01, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
misc cleanup
R=r
http://go/go-review/1016017
parent
45495249
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
53 deletions
+43
-53
src/clean.bash
src/clean.bash
+0
-1
src/cmd/gc/dcl.c
src/cmd/gc/dcl.c
+1
-1
src/pkg/encoding/ascii85/ascii85.go
src/pkg/encoding/ascii85/ascii85.go
+0
-3
src/pkg/exp/datafmt/parser.go
src/pkg/exp/datafmt/parser.go
+0
-1
src/pkg/reflect/value.go
src/pkg/reflect/value.go
+1
-1
src/pkg/strconv/decimal.go
src/pkg/strconv/decimal.go
+0
-4
src/pkg/strconv/ftoa.go
src/pkg/strconv/ftoa.go
+2
-2
src/pkg/strconv/quote.go
src/pkg/strconv/quote.go
+39
-40
No files found.
src/clean.bash
View file @
7732d80c
...
@@ -7,7 +7,6 @@ rm -rf $GOROOT/pkg/${GOOS}_$GOARCH
...
@@ -7,7 +7,6 @@ rm -rf $GOROOT/pkg/${GOOS}_$GOARCH
rm
-f
$GOROOT
/lib/
*
.a
rm
-f
$GOROOT
/lib/
*
.a
for
i
in
lib9 libbio libcgo libmach cmd pkg
\
for
i
in
lib9 libbio libcgo libmach cmd pkg
\
../misc/cgo/gmp ../misc/cgo/stdio
\
../misc/cgo/gmp ../misc/cgo/stdio
\
../usr/r/rpc
\
../test/bench
../test/bench
do
(
do
(
cd
$i
||
exit
1
cd
$i
||
exit
1
...
...
src/cmd/gc/dcl.c
View file @
7732d80c
...
@@ -465,7 +465,7 @@ oldname(Sym *s)
...
@@ -465,7 +465,7 @@ oldname(Sym *s)
}
}
if
(
n
->
oldref
<
100
)
if
(
n
->
oldref
<
100
)
n
->
oldref
++
;
n
->
oldref
++
;
if
(
n
->
funcdepth
>
0
&&
n
->
funcdepth
!=
funcdepth
&&
n
->
op
==
ONAME
)
{
if
(
curfn
!=
nil
&&
n
->
funcdepth
>
0
&&
n
->
funcdepth
!=
funcdepth
&&
n
->
op
==
ONAME
)
{
// inner func is referring to var in outer func.
// inner func is referring to var in outer func.
//
//
// TODO(rsc): If there is an outer variable x and we
// TODO(rsc): If there is an outer variable x and we
...
...
src/pkg/encoding/ascii85/ascii85.go
View file @
7732d80c
...
@@ -123,7 +123,6 @@ func (e *encoder) Write(p []byte) (n int, err os.Error) {
...
@@ -123,7 +123,6 @@ func (e *encoder) Write(p []byte) (n int, err os.Error) {
return
;
return
;
}
}
nout
:=
Encode
(
&
e
.
buf
,
&
e
.
out
);
nout
:=
Encode
(
&
e
.
buf
,
&
e
.
out
);
var
_
int
;
if
_
,
e
.
err
=
e
.
w
.
Write
(
e
.
out
[
0
:
nout
]);
e
.
err
!=
nil
{
if
_
,
e
.
err
=
e
.
w
.
Write
(
e
.
out
[
0
:
nout
]);
e
.
err
!=
nil
{
return
n
,
e
.
err
;
return
n
,
e
.
err
;
}
}
...
@@ -139,7 +138,6 @@ func (e *encoder) Write(p []byte) (n int, err os.Error) {
...
@@ -139,7 +138,6 @@ func (e *encoder) Write(p []byte) (n int, err os.Error) {
nn
-=
nn
%
4
;
nn
-=
nn
%
4
;
if
nn
>
0
{
if
nn
>
0
{
nout
:=
Encode
(
p
[
0
:
nn
],
&
e
.
out
);
nout
:=
Encode
(
p
[
0
:
nn
],
&
e
.
out
);
var
_
int
;
if
_
,
e
.
err
=
e
.
w
.
Write
(
e
.
out
[
0
:
nout
]);
e
.
err
!=
nil
{
if
_
,
e
.
err
=
e
.
w
.
Write
(
e
.
out
[
0
:
nout
]);
e
.
err
!=
nil
{
return
n
,
e
.
err
;
return
n
,
e
.
err
;
}
}
...
@@ -164,7 +162,6 @@ func (e *encoder) Close() os.Error {
...
@@ -164,7 +162,6 @@ func (e *encoder) Close() os.Error {
if
e
.
err
==
nil
&&
e
.
nbuf
>
0
{
if
e
.
err
==
nil
&&
e
.
nbuf
>
0
{
nout
:=
Encode
(
e
.
buf
[
0
:
e
.
nbuf
],
&
e
.
out
);
nout
:=
Encode
(
e
.
buf
[
0
:
e
.
nbuf
],
&
e
.
out
);
e
.
nbuf
=
0
;
e
.
nbuf
=
0
;
var
_
int
;
_
,
e
.
err
=
e
.
w
.
Write
(
e
.
out
[
0
:
nout
]);
_
,
e
.
err
=
e
.
w
.
Write
(
e
.
out
[
0
:
nout
]);
}
}
return
e
.
err
;
return
e
.
err
;
...
...
src/pkg/exp/datafmt/parser.go
View file @
7732d80c
...
@@ -192,7 +192,6 @@ func (p *parser) parseField() expr {
...
@@ -192,7 +192,6 @@ func (p *parser) parseField() expr {
var
ruleName
string
;
var
ruleName
string
;
if
p
.
tok
==
token
.
COLON
{
if
p
.
tok
==
token
.
COLON
{
p
.
next
();
p
.
next
();
var
_
bool
;
ruleName
,
_
=
p
.
parseRuleName
();
ruleName
,
_
=
p
.
parseRuleName
();
}
}
...
...
src/pkg/reflect/value.go
View file @
7732d80c
...
@@ -1330,7 +1330,7 @@ func newValue(typ Type, addr addr, canSet bool) Value {
...
@@ -1330,7 +1330,7 @@ func newValue(typ Type, addr addr, canSet bool) Value {
// All values have same memory layout;
// All values have same memory layout;
// build once and convert.
// build once and convert.
v
:=
&
struct
{
value
}{
value
{
typ
,
addr
,
canSet
}};
v
:=
&
struct
{
value
}{
value
{
typ
,
addr
,
canSet
}};
switch
t
:=
typ
.
(
type
)
{
// TODO(rsc): s/t := // ?
switch
t
yp
.
(
type
)
{
case
*
ArrayType
:
case
*
ArrayType
:
// TODO(rsc): Something must prevent
// TODO(rsc): Something must prevent
// clients of the package from doing
// clients of the package from doing
...
...
src/pkg/strconv/decimal.go
View file @
7732d80c
...
@@ -269,10 +269,6 @@ func leftShift(a *decimal, k uint) {
...
@@ -269,10 +269,6 @@ func leftShift(a *decimal, k uint) {
n
=
quo
;
n
=
quo
;
}
}
if
w
!=
0
{
// TODO: Remove - has no business panicking.
panicln
(
"strconv: bad leftShift"
,
w
);
}
a
.
nd
+=
delta
;
a
.
nd
+=
delta
;
a
.
dp
+=
delta
;
a
.
dp
+=
delta
;
trim
(
a
);
trim
(
a
);
...
...
src/pkg/strconv/ftoa.go
View file @
7732d80c
...
@@ -174,8 +174,8 @@ func roundShortest(d *decimal, mant uint64, exp int, flt *floatInfo) {
...
@@ -174,8 +174,8 @@ func roundShortest(d *decimal, mant uint64, exp int, flt *floatInfo) {
return
;
return
;
}
}
// TODO: Unless exp == minexp, if the number of digits in d
// TODO
(rsc)
: Unless exp == minexp, if the number of digits in d
// is less than 17, it seems
unlikely that it could not
be
// is less than 17, it seems
likely that it would
be
// the shortest possible number already. So maybe we can
// the shortest possible number already. So maybe we can
// bail out without doing the extra multiprecision math here.
// bail out without doing the extra multiprecision math here.
...
...
src/pkg/strconv/quote.go
View file @
7732d80c
...
@@ -5,7 +5,9 @@
...
@@ -5,7 +5,9 @@
package
strconv
package
strconv
import
(
import
(
"bytes"
;
"os"
;
"os"
;
"strings"
;
"unicode"
;
"unicode"
;
"utf8"
;
"utf8"
;
)
)
...
@@ -17,61 +19,58 @@ const lowerhex = "0123456789abcdef"
...
@@ -17,61 +19,58 @@ const lowerhex = "0123456789abcdef"
// sequences (\t, \n, \xFF, \u0100) for control characters
// sequences (\t, \n, \xFF, \u0100) for control characters
// and non-ASCII characters.
// and non-ASCII characters.
func
Quote
(
s
string
)
string
{
func
Quote
(
s
string
)
string
{
// TODO(rsc): String accumulation could be more efficient.
var
buf
bytes
.
Buffer
;
t
:=
`"`
;
buf
.
WriteByte
(
'"'
)
;
for
;
len
(
s
)
>
0
;
s
=
s
[
1
:
len
(
s
)]
{
for
;
len
(
s
)
>
0
;
s
=
s
[
1
:
len
(
s
)]
{
switch
c
:=
s
[
0
];
{
switch
c
:=
s
[
0
];
{
case
c
==
'"'
:
case
c
==
'"'
:
t
+=
`\"`
;
buf
.
WriteString
(
`\"`
)
;
case
c
==
'\\'
:
case
c
==
'\\'
:
t
+=
`\\`
;
buf
.
WriteString
(
`\\`
)
;
case
' '
<=
c
&&
c
<=
'~'
:
case
' '
<=
c
&&
c
<=
'~'
:
t
+=
string
(
c
);
buf
.
WriteString
(
string
(
c
)
);
case
c
==
'\a'
:
case
c
==
'\a'
:
t
+=
`\a`
;
buf
.
WriteString
(
`\a`
)
;
case
c
==
'\b'
:
case
c
==
'\b'
:
t
+=
`\b`
;
buf
.
WriteString
(
`\b`
)
;
case
c
==
'\f'
:
case
c
==
'\f'
:
t
+=
`\f`
;
buf
.
WriteString
(
`\f`
)
;
case
c
==
'\n'
:
case
c
==
'\n'
:
t
+=
`\n`
;
buf
.
WriteString
(
`\n`
)
;
case
c
==
'\r'
:
case
c
==
'\r'
:
t
+=
`\r`
;
buf
.
WriteString
(
`\r`
)
;
case
c
==
'\t'
:
case
c
==
'\t'
:
t
+=
`\t`
;
buf
.
WriteString
(
`\t`
)
;
case
c
==
'\v'
:
case
c
==
'\v'
:
t
+=
`\v`
;
buf
.
WriteString
(
`\v`
)
;
case
c
<
utf8
.
RuneSelf
:
case
c
>=
utf8
.
RuneSelf
&&
utf8
.
FullRuneInString
(
s
)
:
t
+=
`\x`
+
string
(
lowerhex
[
c
>>
4
])
+
string
(
lowerhex
[
c
&
0xF
]);
case
utf8
.
FullRuneInString
(
s
)
:
r
,
size
:=
utf8
.
DecodeRuneInString
(
s
);
r
,
size
:=
utf8
.
DecodeRuneInString
(
s
);
if
r
==
utf8
.
RuneError
&&
size
==
1
{
if
r
==
utf8
.
RuneError
&&
size
==
1
{
goto
EscX
;
goto
EscX
;
}
}
s
=
s
[
size
-
1
:
len
(
s
)];
// next iteration will slice off 1 more
s
=
s
[
size
-
1
:
len
(
s
)];
// next iteration will slice off 1 more
if
r
<
0x10000
{
if
r
<
0x10000
{
t
+=
`\u`
;
buf
.
WriteString
(
`\u`
)
;
for
j
:=
uint
(
0
);
j
<
4
;
j
++
{
for
j
:=
uint
(
0
);
j
<
4
;
j
++
{
t
+=
string
(
lowerhex
[(
r
>>
(
12
-
4
*
j
))
&
0xF
]);
buf
.
WriteByte
(
lowerhex
[(
r
>>
(
12
-
4
*
j
))
&
0xF
]);
}
}
}
else
{
}
else
{
t
+=
`\U`
;
buf
.
WriteString
(
`\U`
)
;
for
j
:=
uint
(
0
);
j
<
8
;
j
++
{
for
j
:=
uint
(
0
);
j
<
8
;
j
++
{
t
+=
string
(
lowerhex
[(
r
>>
(
28
-
4
*
j
))
&
0xF
]);
buf
.
WriteByte
(
lowerhex
[(
r
>>
(
28
-
4
*
j
))
&
0xF
]);
}
}
}
}
default
:
default
:
EscX
:
EscX
:
t
+=
`\x`
;
buf
.
WriteString
(
`\x`
)
;
t
+=
string
(
lowerhex
[
c
>>
4
]);
buf
.
WriteByte
(
lowerhex
[
c
>>
4
]);
t
+=
string
(
lowerhex
[
c
&
0xF
]);
buf
.
WriteByte
(
lowerhex
[
c
&
0xF
]);
}
}
}
}
t
+=
`"`
;
buf
.
WriteByte
(
'"'
)
;
return
t
;
return
buf
.
String
()
;
}
}
// CanBackquote returns whether the string s would be
// CanBackquote returns whether the string s would be
...
@@ -223,42 +222,42 @@ func UnquoteChar(s string, quote byte) (value int, multibyte bool, tail string,
...
@@ -223,42 +222,42 @@ func UnquoteChar(s string, quote byte) (value int, multibyte bool, tail string,
// character literal; Unquote returns the corresponding
// character literal; Unquote returns the corresponding
// one-character string.)
// one-character string.)
func
Unquote
(
s
string
)
(
t
string
,
err
os
.
Error
)
{
func
Unquote
(
s
string
)
(
t
string
,
err
os
.
Error
)
{
err
=
os
.
EINVAL
;
// assume error for easy return
n
:=
len
(
s
);
n
:=
len
(
s
);
if
n
<
2
{
if
n
<
2
{
return
;
return
""
,
os
.
EINVAL
;
}
}
quote
:=
s
[
0
];
quote
:=
s
[
0
];
if
quote
!=
s
[
n
-
1
]
{
if
quote
!=
s
[
n
-
1
]
{
return
;
return
""
,
os
.
EINVAL
;
}
}
s
=
s
[
1
:
n
-
1
];
s
=
s
[
1
:
n
-
1
];
if
quote
==
'`'
{
if
quote
==
'`'
{
if
strings
.
Index
(
s
,
"`"
)
>=
0
{
return
""
,
os
.
EINVAL
;
}
return
s
,
nil
;
return
s
,
nil
;
}
}
if
quote
!=
'"'
&&
quote
!=
'\'
'
{
if
quote
!=
'"'
&&
quote
!=
'\'
'
{
return
;
return
""
,
err
;
}
}
// TODO(rsc): String accumulation could be more efficient.
var
buf
bytes
.
Buffer
;
var
tt
string
;
for
len
(
s
)
>
0
{
for
len
(
s
)
>
0
{
c
,
multibyte
,
ss
,
err1
:=
UnquoteChar
(
s
,
quote
);
c
,
multibyte
,
ss
,
err
:=
UnquoteChar
(
s
,
quote
);
if
err1
!=
nil
{
if
err
!=
nil
{
err
=
err1
;
return
""
,
err
;
return
;
}
}
s
=
ss
;
s
=
ss
;
if
multibyte
||
c
<
utf8
.
RuneSelf
{
if
c
<
utf8
.
RuneSelf
||
!
multibyte
{
tt
+=
string
(
c
);
buf
.
WriteByte
(
byte
(
c
)
);
}
else
{
}
else
{
tt
+=
string
([]
byte
{
byte
(
c
)}
);
buf
.
WriteString
(
string
(
c
)
);
}
}
if
quote
==
'\'
'
&&
len
(
s
)
!=
0
{
if
quote
==
'\'
'
&&
len
(
s
)
!=
0
{
// single-quoted must be single character
// single-quoted must be single character
return
;
return
""
,
os
.
EINVAL
;
}
}
}
}
return
tt
,
nil
;
return
buf
.
String
()
,
nil
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment