mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-23 09:05:32 +00:00
Re-introduced Yosys::readsome() helper function
(f.read() + f.gcount() made problems with lines > 16kB)
This commit is contained in:
parent
750c615e7f
commit
c5eb5e56b8
6 changed files with 25 additions and 21 deletions
|
@ -68,13 +68,10 @@ struct WriteFileFrontend : public Frontend {
|
|||
|
||||
FILE *of = fopen(output_filename.c_str(), append_mode ? "a" : "w");
|
||||
char buffer[64 * 1024];
|
||||
int bytes;
|
||||
|
||||
while (1) {
|
||||
f->read(buffer, sizeof(buffer));
|
||||
if (f->gcount() <= 0)
|
||||
break;
|
||||
fwrite(buffer, f->gcount(), 1, of);
|
||||
}
|
||||
while (0 < (bytes = readsome(*f, buffer, sizeof(buffer))))
|
||||
fwrite(buffer, bytes, 1, of);
|
||||
|
||||
fclose(of);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue