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
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
src/cmd/6g/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)
...
@@ -73,7 +73,7 @@ Pconv(Fmt *fp)
int
int
Dconv
(
Fmt
*
fp
)
Dconv
(
Fmt
*
fp
)
{
{
char
str
[
40
],
s
[
2
0
];
char
str
[
100
],
s
[
10
0
];
Addr
*
a
;
Addr
*
a
;
int
i
;
int
i
;
uint32
d1
,
d2
;
uint32
d1
,
d2
;
...
@@ -82,18 +82,18 @@ Dconv(Fmt *fp)
...
@@ -82,18 +82,18 @@ Dconv(Fmt *fp)
i
=
a
->
type
;
i
=
a
->
type
;
if
(
i
>=
D_INDIR
)
{
if
(
i
>=
D_INDIR
)
{
if
(
a
->
offset
)
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
else
s
print
(
str
,
"(%R)"
,
i
-
D_INDIR
);
s
nprint
(
str
,
sizeof
(
str
)
,
"(%R)"
,
i
-
D_INDIR
);
goto
brk
;
goto
brk
;
}
}
switch
(
i
)
{
switch
(
i
)
{
default:
default:
if
(
a
->
offset
)
if
(
a
->
offset
)
s
print
(
str
,
"$%lld,%R"
,
a
->
offset
,
i
);
s
nprint
(
str
,
sizeof
(
str
)
,
"$%lld,%R"
,
a
->
offset
,
i
);
else
else
s
print
(
str
,
"%R"
,
i
);
s
nprint
(
str
,
sizeof
(
str
)
,
"%R"
,
i
);
break
;
break
;
case
D_NONE
:
case
D_NONE
:
...
@@ -105,50 +105,50 @@ Dconv(Fmt *fp)
...
@@ -105,50 +105,50 @@ Dconv(Fmt *fp)
break
;
break
;
case
D_EXTERN
:
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
;
break
;
case
D_STATIC
:
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
;
break
;
case
D_AUTO
:
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
;
break
;
case
D_PARAM
:
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
;
break
;
case
D_CONST
:
case
D_CONST
:
if
(
fp
->
flags
&
FmtLong
)
{
if
(
fp
->
flags
&
FmtLong
)
{
d1
=
a
->
offset
&
0xffffffffLL
;
d1
=
a
->
offset
&
0xffffffffLL
;
d2
=
(
a
->
offset
>>
32
)
&
0xffffffffLL
;
d2
=
(
a
->
offset
>>
32
)
&
0xffffffffLL
;
s
print
(
str
,
"$%lud-%lud"
,
d1
,
d2
);
s
nprint
(
str
,
sizeof
(
str
)
,
"$%lud-%lud"
,
d1
,
d2
);
break
;
break
;
}
}
s
print
(
str
,
"$%lld"
,
a
->
offset
);
s
nprint
(
str
,
sizeof
(
str
)
,
"$%lld"
,
a
->
offset
);
break
;
break
;
case
D_FCONST
:
case
D_FCONST
:
s
print
(
str
,
"$(%.17e)"
,
a
->
dval
);
s
nprint
(
str
,
sizeof
(
str
)
,
"$(%.17e)"
,
a
->
dval
);
break
;
break
;
case
D_SCONST
:
case
D_SCONST
:
s
print
(
str
,
"$
\"
%Y
\"
"
,
a
->
sval
);
s
nprint
(
str
,
sizeof
(
str
)
,
"$
\"
%Y
\"
"
,
a
->
sval
);
break
;
break
;
case
D_ADDR
:
case
D_ADDR
:
a
->
type
=
a
->
index
;
a
->
type
=
a
->
index
;
a
->
index
=
D_NONE
;
a
->
index
=
D_NONE
;
s
print
(
str
,
"$%D"
,
a
);
s
nprint
(
str
,
sizeof
(
str
)
,
"$%D"
,
a
);
a
->
index
=
a
->
type
;
a
->
index
=
a
->
type
;
a
->
type
=
D_ADDR
;
a
->
type
=
D_ADDR
;
goto
conv
;
goto
conv
;
}
}
brk:
brk:
if
(
a
->
index
!=
D_NONE
)
{
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
);
strcat
(
str
,
s
);
}
}
conv:
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