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
0e47c75f
Commit
0e47c75f
authored
Feb 05, 2010
by
Dean Prichard
Committed by
Russ Cox
Feb 05, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
5a/6a/8a/5c/6c/8c: remove fixed-size arrays for -I and -D options
R=rsc CC=golang-dev
https://golang.org/cl/198044
parent
04217ee5
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
41 additions
and
32 deletions
+41
-32
src/cmd/5a/a.h
src/cmd/5a/a.h
+2
-3
src/cmd/5a/lex.c
src/cmd/5a/lex.c
+6
-2
src/cmd/6a/a.h
src/cmd/6a/a.h
+2
-3
src/cmd/6a/lex.c
src/cmd/6a/lex.c
+6
-2
src/cmd/8a/a.h
src/cmd/8a/a.h
+2
-3
src/cmd/8a/lex.c
src/cmd/8a/lex.c
+6
-2
src/cmd/cc/cc.h
src/cmd/cc/cc.h
+1
-1
src/cmd/cc/lex.c
src/cmd/cc/lex.c
+12
-11
src/cmd/cc/lexbody
src/cmd/cc/lexbody
+4
-5
No files found.
src/cmd/5a/a.h
View file @
0e47c75f
...
...
@@ -54,7 +54,6 @@ typedef struct Hist Hist;
#define NSYMB 8192
#define BUFSIZ 8192
#define HISTSZ 20
#define NINCLUDE 10
#define NHUNK 10000
#define EOF (-1)
#define IGN (-2)
...
...
@@ -128,13 +127,13 @@ enum
EXTERN
char
debug
[
256
];
EXTERN
Sym
*
hash
[
NHASH
];
EXTERN
char
*
Dlist
[
30
]
;
EXTERN
char
*
*
Dlist
;
EXTERN
int
nDlist
;
EXTERN
Hist
*
ehist
;
EXTERN
int
newflag
;
EXTERN
Hist
*
hist
;
EXTERN
char
*
hunk
;
EXTERN
char
*
include
[
NINCLUDE
]
;
EXTERN
char
*
*
include
;
EXTERN
Io
*
iofree
;
EXTERN
Io
*
ionext
;
EXTERN
Io
*
iostack
;
...
...
src/cmd/5a/lex.c
View file @
0e47c75f
...
...
@@ -62,7 +62,7 @@ main(int argc, char *argv[])
memset
(
debug
,
0
,
sizeof
(
debug
));
cinit
();
outfile
=
0
;
include
[
ninclude
++
]
=
"."
;
setinclude
(
"."
)
;
ARGBEGIN
{
default:
c
=
ARGC
();
...
...
@@ -76,8 +76,12 @@ main(int argc, char *argv[])
case
'D'
:
p
=
ARGF
();
if
(
p
)
if
(
p
)
{
if
(
nDlist
%
8
==
0
)
Dlist
=
allocn
(
Dlist
,
nDlist
*
sizeof
(
char
*
),
8
*
sizeof
(
char
*
));
Dlist
[
nDlist
++
]
=
p
;
}
break
;
case
'I'
:
...
...
src/cmd/6a/a.h
View file @
0e47c75f
...
...
@@ -57,7 +57,6 @@ typedef struct Gen2 Gen2;
#define NSYMB 500
#define BUFSIZ 8192
#define HISTSZ 20
#define NINCLUDE 10
#define NHUNK 10000
#define EOF (-1)
#define IGN (-2)
...
...
@@ -141,13 +140,13 @@ enum
EXTERN
char
debug
[
256
];
EXTERN
Sym
*
hash
[
NHASH
];
EXTERN
char
*
Dlist
[
30
]
;
EXTERN
char
*
*
Dlist
;
EXTERN
int
nDlist
;
EXTERN
Hist
*
ehist
;
EXTERN
int
newflag
;
EXTERN
Hist
*
hist
;
EXTERN
char
*
hunk
;
EXTERN
char
*
include
[
NINCLUDE
]
;
EXTERN
char
*
*
include
;
EXTERN
Io
*
iofree
;
EXTERN
Io
*
ionext
;
EXTERN
Io
*
iostack
;
...
...
src/cmd/6a/lex.c
View file @
0e47c75f
...
...
@@ -65,7 +65,7 @@ main(int argc, char *argv[])
memset
(
debug
,
0
,
sizeof
(
debug
));
cinit
();
outfile
=
0
;
include
[
ninclude
++
]
=
"."
;
setinclude
(
"."
)
;
ARGBEGIN
{
default:
c
=
ARGC
();
...
...
@@ -79,8 +79,12 @@ main(int argc, char *argv[])
case
'D'
:
p
=
ARGF
();
if
(
p
)
if
(
p
)
{
if
(
nDlist
%
8
==
0
)
Dlist
=
allocn
(
Dlist
,
nDlist
*
sizeof
(
char
*
),
8
*
sizeof
(
char
*
));
Dlist
[
nDlist
++
]
=
p
;
}
break
;
case
'I'
:
...
...
src/cmd/8a/a.h
View file @
0e47c75f
...
...
@@ -57,7 +57,6 @@ typedef struct Gen2 Gen2;
#define NSYMB 500
#define BUFSIZ 8192
#define HISTSZ 20
#define NINCLUDE 10
#define NHUNK 10000
#define EOF (-1)
#define IGN (-2)
...
...
@@ -142,13 +141,13 @@ enum
EXTERN
char
debug
[
256
];
EXTERN
Sym
*
hash
[
NHASH
];
EXTERN
char
*
Dlist
[
30
]
;
EXTERN
char
*
*
Dlist
;
EXTERN
int
nDlist
;
EXTERN
Hist
*
ehist
;
EXTERN
int
newflag
;
EXTERN
Hist
*
hist
;
EXTERN
char
*
hunk
;
EXTERN
char
*
include
[
NINCLUDE
]
;
EXTERN
char
*
*
include
;
EXTERN
Io
*
iofree
;
EXTERN
Io
*
ionext
;
EXTERN
Io
*
iostack
;
...
...
src/cmd/8a/lex.c
View file @
0e47c75f
...
...
@@ -65,7 +65,7 @@ main(int argc, char *argv[])
memset
(
debug
,
0
,
sizeof
(
debug
));
cinit
();
outfile
=
0
;
include
[
ninclude
++
]
=
"."
;
setinclude
(
"."
)
;
ARGBEGIN
{
default:
c
=
ARGC
();
...
...
@@ -79,8 +79,12 @@ main(int argc, char *argv[])
case
'D'
:
p
=
ARGF
();
if
(
p
)
if
(
p
)
{
if
(
nDlist
%
8
==
0
)
Dlist
=
allocn
(
Dlist
,
nDlist
*
sizeof
(
char
*
),
8
*
sizeof
(
char
*
));
Dlist
[
nDlist
++
]
=
p
;
}
break
;
case
'I'
:
...
...
src/cmd/cc/cc.h
View file @
0e47c75f
...
...
@@ -475,7 +475,7 @@ EXTERN Decl* firstdcl;
EXTERN
int
fperror
;
EXTERN
Sym
*
hash
[
NHASH
];
EXTERN
char
*
hunk
;
EXTERN
char
*
include
[
20
]
;
EXTERN
char
*
*
include
;
EXTERN
Io
*
iofree
;
EXTERN
Io
*
ionext
;
EXTERN
Io
*
iostack
;
...
...
src/cmd/cc/lex.c
View file @
0e47c75f
...
...
@@ -82,7 +82,7 @@ pathchar(void)
void
main
(
int
argc
,
char
*
argv
[])
{
char
*
defs
[
50
]
,
*
p
;
char
*
*
defs
,
*
p
;
int
nproc
,
nout
,
i
,
c
,
ndef
;
ensuresymb
(
NSYMB
);
...
...
@@ -94,8 +94,9 @@ main(int argc, char *argv[])
tufield
=
simplet
((
1L
<<
tfield
->
etype
)
|
BUNSIGNED
);
ndef
=
0
;
defs
=
nil
;
outfile
=
0
;
include
[
ninclude
++
]
=
"."
;
setinclude
(
"."
)
;
ARGBEGIN
{
default:
c
=
ARGC
();
...
...
@@ -119,6 +120,9 @@ main(int argc, char *argv[])
case
'D'
:
p
=
ARGF
();
if
(
p
)
{
if
(
ndef
%
8
==
0
)
defs
=
allocn
(
defs
,
ndef
*
sizeof
(
char
*
),
8
*
sizeof
(
char
*
));
defs
[
ndef
++
]
=
p
;
dodefine
(
p
);
}
...
...
@@ -193,7 +197,7 @@ int
compile
(
char
*
file
,
char
**
defs
,
int
ndef
)
{
char
*
ofile
,
incfile
[
20
];
char
*
p
,
*
av
[
100
]
,
opt
[
256
];
char
*
p
,
*
*
av
,
opt
[
256
];
int
i
,
c
,
fd
[
2
];
static
int
first
=
1
;
...
...
@@ -283,6 +287,7 @@ compile(char *file, char **defs, int ndef)
close
(
fd
[
0
]);
dup
(
fd
[
1
],
1
);
close
(
fd
[
1
]);
av
=
alloc
((
ndef
+
ninclude
+
5
)
*
sizeof
(
char
*
));
av
[
0
]
=
CPP
;
i
=
1
;
if
(
debug
[
'.'
]){
...
...
@@ -1548,14 +1553,10 @@ setinclude(char *p)
if
(
strcmp
(
p
,
include
[
i
])
==
0
)
return
;
if
(
i
>=
ninclude
)
include
[
ninclude
++
]
=
p
;
if
(
ninclude
>
nelem
(
include
))
{
diag
(
Z
,
"ninclude too small %d"
,
nelem
(
include
));
exits
(
"ninclude"
);
}
if
(
ninclude
%
8
==
0
)
include
=
allocn
(
include
,
ninclude
*
sizeof
(
char
*
),
8
*
sizeof
(
char
*
));
include
[
ninclude
++
]
=
p
;
}
}
...
...
src/cmd/cc/lexbody
View file @
0e47c75f
...
...
@@ -149,11 +149,10 @@ setinclude(char *p)
for(i=1; i < ninclude; i++)
if(strcmp(p, include[i]) == 0)
return;
if(ninclude >= nelem(include)) {
yyerror("ninclude too small %d", nelem(include));
exits("ninclude");
}
if(ninclude%8 == 0)
include = allocn(include, ninclude*sizeof(char *),
8*sizeof(char *));
include[ninclude++] = p;
}
...
...
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