Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
9022605c
Commit
9022605c
authored
Nov 01, 1993
by
Richard Stallman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(safe_write): New function.
(write_output): Use safe_write. From-SVN: r5960
parent
a3fb124a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
gcc/cccp.c
+22
-6
No files found.
gcc/cccp.c
View file @
9022605c
...
@@ -4746,6 +4746,24 @@ pcstring_used (hp)
...
@@ -4746,6 +4746,24 @@ pcstring_used (hp)
delete_macro
(
hp
);
delete_macro
(
hp
);
}
}
/* Write LEN bytes at PTR to descriptor DESC,
retrying if necessary, and treating any real error as fatal. */
static
void
safe_write
(
desc
,
ptr
,
len
)
int
desc
;
char
*
ptr
;
int
len
;
{
while
(
len
>
0
)
{
int
written
=
write
(
fileno
(
stdout
),
ptr
,
len
);
if
(
written
<
0
)
pfatal_with_name
(
out_fname
);
ptr
+=
written
;
len
-=
written
;
}
}
/* Write the output, interspersing precompiled strings in their */
/* Write the output, interspersing precompiled strings in their */
/* appropriate places. */
/* appropriate places. */
static
void
static
void
...
@@ -4756,6 +4774,7 @@ write_output ()
...
@@ -4756,6 +4774,7 @@ write_output ()
int
line_command_len
=
80
;
int
line_command_len
=
80
;
char
*
line_command
=
xmalloc
(
line_command_len
);
char
*
line_command
=
xmalloc
(
line_command_len
);
int
len
;
int
len
;
int
written
;
/* In each run through the loop, either cur_buf_loc == */
/* In each run through the loop, either cur_buf_loc == */
/* next_string_loc, in which case we print a series of strings, or */
/* next_string_loc, in which case we print a series of strings, or */
...
@@ -4776,10 +4795,8 @@ write_output ()
...
@@ -4776,10 +4795,8 @@ write_output ()
strcpy
(
quote_string
(
line_command
+
strlen
(
line_command
),
strcpy
(
quote_string
(
line_command
+
strlen
(
line_command
),
next_string
->
filename
),
next_string
->
filename
),
"
\n
"
);
"
\n
"
);
if
(
write
(
fileno
(
stdout
),
line_command
,
strlen
(
line_command
))
<
0
)
safe_write
(
fileno
(
stdout
),
line_command
,
strlen
(
line_command
));
pfatal_with_name
(
out_fname
);
safe_write
(
fileno
(
stdout
),
next_string
->
contents
,
next_string
->
len
);
if
(
write
(
fileno
(
stdout
),
next_string
->
contents
,
next_string
->
len
)
<
0
)
pfatal_with_name
(
out_fname
);
}
}
next_string
=
next_string
->
chain
;
next_string
=
next_string
->
chain
;
}
}
...
@@ -4789,8 +4806,7 @@ write_output ()
...
@@ -4789,8 +4806,7 @@ write_output ()
-
(
cur_buf_loc
-
outbuf
.
buf
))
-
(
cur_buf_loc
-
outbuf
.
buf
))
:
outbuf
.
bufp
-
cur_buf_loc
);
:
outbuf
.
bufp
-
cur_buf_loc
);
if
(
write
(
fileno
(
stdout
),
cur_buf_loc
,
len
)
<
len
)
safe_write
(
fileno
(
stdout
),
cur_buf_loc
,
len
);
pfatal_with_name
(
out_fname
);
cur_buf_loc
+=
len
;
cur_buf_loc
+=
len
;
}
}
}
}
...
...
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