Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
bb3269fb
Commit
bb3269fb
authored
Sep 13, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
snprints for safety
R=r OCL=15311 CL=15311
parent
c1ad0509
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
list.c
src/cmd/6g/list.c
+15
-15
No files found.
src/cmd/6g/list.c
View file @
bb3269fb
...
...
@@ -73,7 +73,7 @@ Pconv(Fmt *fp)
int
Dconv
(
Fmt
*
fp
)
{
char
str
[
40
],
s
[
2
0
];
char
str
[
100
],
s
[
10
0
];
Addr
*
a
;
int
i
;
uint32
d1
,
d2
;
...
...
@@ -82,18 +82,18 @@ Dconv(Fmt *fp)
i
=
a
->
type
;
if
(
i
>=
D_INDIR
)
{
if
(
a
->
offset
)
s
print
(
str
,
"%lld(%R)"
,
a
->
offset
,
i
-
D_INDIR
);
s
nprint
(
str
,
sizeof
(
str
)
,
"%lld(%R)"
,
a
->
offset
,
i
-
D_INDIR
);
else
s
print
(
str
,
"(%R)"
,
i
-
D_INDIR
);
s
nprint
(
str
,
sizeof
(
str
)
,
"(%R)"
,
i
-
D_INDIR
);
goto
brk
;
}
switch
(
i
)
{
default:
if
(
a
->
offset
)
s
print
(
str
,
"$%lld,%R"
,
a
->
offset
,
i
);
s
nprint
(
str
,
sizeof
(
str
)
,
"$%lld,%R"
,
a
->
offset
,
i
);
else
s
print
(
str
,
"%R"
,
i
);
s
nprint
(
str
,
sizeof
(
str
)
,
"%R"
,
i
);
break
;
case
D_NONE
:
...
...
@@ -105,50 +105,50 @@ Dconv(Fmt *fp)
break
;
case
D_EXTERN
:
s
print
(
str
,
"%S+%lld(SB)"
,
a
->
sym
,
a
->
offset
);
s
nprint
(
str
,
sizeof
(
str
)
,
"%S+%lld(SB)"
,
a
->
sym
,
a
->
offset
);
break
;
case
D_STATIC
:
s
print
(
str
,
"%S<>+%lld(SB)"
,
a
->
sym
,
a
->
offset
);
s
nprint
(
str
,
sizeof
(
str
)
,
"%S<>+%lld(SB)"
,
a
->
sym
,
a
->
offset
);
break
;
case
D_AUTO
:
s
print
(
str
,
"%S+%lld(SP)"
,
a
->
sym
,
a
->
offset
);
s
nprint
(
str
,
sizeof
(
str
)
,
"%S+%lld(SP)"
,
a
->
sym
,
a
->
offset
);
break
;
case
D_PARAM
:
s
print
(
str
,
"%S+%lld(FP)"
,
a
->
sym
,
a
->
offset
);
s
nprint
(
str
,
sizeof
(
str
)
,
"%S+%lld(FP)"
,
a
->
sym
,
a
->
offset
);
break
;
case
D_CONST
:
if
(
fp
->
flags
&
FmtLong
)
{
d1
=
a
->
offset
&
0xffffffffLL
;
d2
=
(
a
->
offset
>>
32
)
&
0xffffffffLL
;
s
print
(
str
,
"$%lud-%lud"
,
d1
,
d2
);
s
nprint
(
str
,
sizeof
(
str
)
,
"$%lud-%lud"
,
d1
,
d2
);
break
;
}
s
print
(
str
,
"$%lld"
,
a
->
offset
);
s
nprint
(
str
,
sizeof
(
str
)
,
"$%lld"
,
a
->
offset
);
break
;
case
D_FCONST
:
s
print
(
str
,
"$(%.17e)"
,
a
->
dval
);
s
nprint
(
str
,
sizeof
(
str
)
,
"$(%.17e)"
,
a
->
dval
);
break
;
case
D_SCONST
:
s
print
(
str
,
"$
\"
%Y
\"
"
,
a
->
sval
);
s
nprint
(
str
,
sizeof
(
str
)
,
"$
\"
%Y
\"
"
,
a
->
sval
);
break
;
case
D_ADDR
:
a
->
type
=
a
->
index
;
a
->
index
=
D_NONE
;
s
print
(
str
,
"$%D"
,
a
);
s
nprint
(
str
,
sizeof
(
str
)
,
"$%D"
,
a
);
a
->
index
=
a
->
type
;
a
->
type
=
D_ADDR
;
goto
conv
;
}
brk:
if
(
a
->
index
!=
D_NONE
)
{
s
print
(
s
,
"(%R*%d)"
,
(
int
)
a
->
index
,
(
int
)
a
->
scale
);
s
nprint
(
s
,
sizeof
(
s
)
,
"(%R*%d)"
,
(
int
)
a
->
index
,
(
int
)
a
->
scale
);
strcat
(
str
,
s
);
}
conv:
...
...
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