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
6fff0efd
Commit
6fff0efd
authored
Nov 01, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sprint changed to snprint
R=r OCL=18316 CL=18316
parent
db27d309
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
30 deletions
+30
-30
list.c
src/cmd/6l/list.c
+30
-30
No files found.
src/cmd/6l/list.c
View file @
6fff0efd
...
...
@@ -52,27 +52,27 @@ Pconv(Fmt *fp)
p
=
va_arg
(
fp
->
args
,
Prog
*
);
bigP
=
p
;
s
print
(
str1
,
"(%ld)"
,
p
->
line
);
s
nprint
(
str1
,
sizeof
(
str1
)
,
"(%ld)"
,
p
->
line
);
switch
(
p
->
as
)
{
case
ATEXT
:
if
(
p
->
from
.
scale
)
{
s
print
(
str
,
"%-7s %-7A %D,%d,%lD"
,
s
nprint
(
str
,
sizeof
(
str
)
,
"%-7s %-7A %D,%d,%lD"
,
str1
,
p
->
as
,
&
p
->
from
,
p
->
from
.
scale
,
&
p
->
to
);
break
;
}
s
print
(
str
,
"%-7s %-7A %D,%lD"
,
s
nprint
(
str
,
sizeof
(
str
)
,
"%-7s %-7A %D,%lD"
,
str1
,
p
->
as
,
&
p
->
from
,
&
p
->
to
);
break
;
default:
s
print
(
str
,
"%-7s %-7A %D,%D"
,
s
nprint
(
str
,
sizeof
(
str
)
,
"%-7s %-7A %D,%D"
,
str1
,
p
->
as
,
&
p
->
from
,
&
p
->
to
);
break
;
case
ADATA
:
case
AINIT
:
case
ADYNT
:
s
print
(
str
,
"%-7s %-7A %D/%d,%D"
,
s
nprint
(
str
,
sizeof
(
str
)
,
"%-7s %-7A %D/%d,%D"
,
str1
,
p
->
as
,
&
p
->
from
,
p
->
from
.
scale
,
&
p
->
to
);
break
;
}
...
...
@@ -102,32 +102,32 @@ Dconv(Fmt *fp)
if
(
fp
->
flags
&
FmtLong
)
{
if
(
i
!=
D_CONST
)
{
// ATEXT dst is not constant
s
print
(
str
,
"!!%D"
,
a
);
s
nprint
(
str
,
sizeof
(
str
)
,
"!!%D"
,
a
);
goto
brk
;
}
parsetextconst
(
a
->
offset
);
if
(
textarg
==
0
)
{
s
print
(
str
,
"$%lld"
,
textstksiz
);
s
nprint
(
str
,
sizeof
(
str
)
,
"$%lld"
,
textstksiz
);
goto
brk
;
}
s
print
(
str
,
"$%lld-%lld"
,
textstksiz
,
textarg
);
s
nprint
(
str
,
sizeof
(
str
)
,
"$%lld-%lld"
,
textstksiz
,
textarg
);
goto
brk
;
}
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
:
...
...
@@ -137,70 +137,70 @@ Dconv(Fmt *fp)
case
D_BRANCH
:
if
(
bigP
!=
P
&&
bigP
->
pcond
!=
P
)
if
(
a
->
sym
!=
S
)
s
print
(
str
,
"%llux+%s"
,
bigP
->
pcond
->
pc
,
s
nprint
(
str
,
sizeof
(
str
)
,
"%llux+%s"
,
bigP
->
pcond
->
pc
,
a
->
sym
->
name
);
else
s
print
(
str
,
"%llux"
,
bigP
->
pcond
->
pc
);
s
nprint
(
str
,
sizeof
(
str
)
,
"%llux"
,
bigP
->
pcond
->
pc
);
else
s
print
(
str
,
"%lld(PC)"
,
a
->
offset
);
s
nprint
(
str
,
sizeof
(
str
)
,
"%lld(PC)"
,
a
->
offset
);
break
;
case
D_EXTERN
:
if
(
a
->
sym
)
{
s
print
(
str
,
"%s+%lld(SB)"
,
a
->
sym
->
name
,
a
->
offset
);
s
nprint
(
str
,
sizeof
(
str
)
,
"%s+%lld(SB)"
,
a
->
sym
->
name
,
a
->
offset
);
break
;
}
s
print
(
str
,
"!!noname!!+%lld(SB)"
,
a
->
offset
);
s
nprint
(
str
,
sizeof
(
str
)
,
"!!noname!!+%lld(SB)"
,
a
->
offset
);
break
;
case
D_STATIC
:
if
(
a
->
sym
)
{
s
print
(
str
,
"%s<%d>+%lld(SB)"
,
a
->
sym
->
name
,
s
nprint
(
str
,
sizeof
(
str
)
,
"%s<%d>+%lld(SB)"
,
a
->
sym
->
name
,
a
->
sym
->
version
,
a
->
offset
);
break
;
}
s
print
(
str
,
"!!noname!!<999>+%lld(SB)"
,
a
->
offset
);
s
nprint
(
str
,
sizeof
(
str
)
,
"!!noname!!<999>+%lld(SB)"
,
a
->
offset
);
break
;
case
D_AUTO
:
if
(
a
->
sym
)
{
s
print
(
str
,
"%s+%lld(SP)"
,
a
->
sym
->
name
,
a
->
offset
);
s
nprint
(
str
,
sizeof
(
str
)
,
"%s+%lld(SP)"
,
a
->
sym
->
name
,
a
->
offset
);
break
;
}
s
print
(
str
,
"!!noname!!+%lld(SP)"
,
a
->
offset
);
s
nprint
(
str
,
sizeof
(
str
)
,
"!!noname!!+%lld(SP)"
,
a
->
offset
);
break
;
case
D_PARAM
:
if
(
a
->
sym
)
{
s
print
(
str
,
"%s+%lld(%s)"
,
a
->
sym
->
name
,
a
->
offset
,
paramspace
);
s
nprint
(
str
,
sizeof
(
str
)
,
"%s+%lld(%s)"
,
a
->
sym
->
name
,
a
->
offset
,
paramspace
);
break
;
}
s
print
(
str
,
"!!noname!!+%lld(%s)"
,
a
->
offset
,
paramspace
);
s
nprint
(
str
,
sizeof
(
str
)
,
"!!noname!!+%lld(%s)"
,
a
->
offset
,
paramspace
);
break
;
case
D_CONST
:
s
print
(
str
,
"$%lld"
,
a
->
offset
);
s
nprint
(
str
,
sizeof
(
str
)
,
"$%lld"
,
a
->
offset
);
break
;
case
D_FCONST
:
s
print
(
str
,
"$(%.8lux,%.8lux)"
,
a
->
ieee
.
h
,
a
->
ieee
.
l
);
s
nprint
(
str
,
sizeof
(
str
)
,
"$(%.8lux,%.8lux)"
,
a
->
ieee
.
h
,
a
->
ieee
.
l
);
break
;
case
D_SCONST
:
s
print
(
str
,
"$
\"
%S
\"
"
,
a
->
scon
);
s
nprint
(
str
,
sizeof
(
str
)
,
"$
\"
%S
\"
"
,
a
->
scon
);
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)"
,
a
->
index
,
a
->
scale
);
s
nprint
(
s
,
sizeof
(
s
)
,
"(%R*%d)"
,
a
->
index
,
a
->
scale
);
strcat
(
str
,
s
);
}
conv:
...
...
@@ -342,9 +342,9 @@ Rconv(Fmt *fp)
r
=
va_arg
(
fp
->
args
,
int
);
if
(
r
>=
D_AL
&&
r
<=
D_NONE
)
s
print
(
str
,
"%s"
,
regstr
[
r
-
D_AL
]);
s
nprint
(
str
,
sizeof
(
str
)
,
"%s"
,
regstr
[
r
-
D_AL
]);
else
s
print
(
str
,
"gok(%d)"
,
r
);
s
nprint
(
str
,
sizeof
(
str
)
,
"gok(%d)"
,
r
);
return
fmtstrcpy
(
fp
,
str
);
}
...
...
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