diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-10-23 10:47:21 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-10-23 10:58:36 +0200 |
commit | c5eb5e56b8911bb520a987761739bbb9d9328380 (patch) | |
tree | 6a578b95c4bc007bb87928df299f90391abfcc07 /passes/cmds | |
parent | 750c615e7f01d44db4a7d504024b3681a56d8a78 (diff) | |
download | yosys-c5eb5e56b8911bb520a987761739bbb9d9328380.tar.gz yosys-c5eb5e56b8911bb520a987761739bbb9d9328380.tar.bz2 yosys-c5eb5e56b8911bb520a987761739bbb9d9328380.zip |
Re-introduced Yosys::readsome() helper function
(f.read() + f.gcount() made problems with lines > 16kB)
Diffstat (limited to 'passes/cmds')
-rw-r--r-- | passes/cmds/write_file.cc | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/passes/cmds/write_file.cc b/passes/cmds/write_file.cc index 9bf1a75a8..25ec4acc2 100644 --- a/passes/cmds/write_file.cc +++ b/passes/cmds/write_file.cc @@ -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); } |