diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-12-02 16:20:58 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-12-02 16:20:58 -0800 |
commit | 366af1187ad409b2fca12cd7a2b939019727db7d (patch) | |
tree | b80d1b2a9edbcf1aa12ada60d76801835efbb607 /src/main.c | |
parent | 4cf29883ef1307de329bf381d53e9aeb8e1f65a7 (diff) | |
parent | 7f5ee96078ac6f283767d2b582ea334fe9c18ff4 (diff) |
Merge pull request #232 from nwellnhof/eof_detection
Fix EOF detection
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -71,6 +71,9 @@ int main(int argc, char *argv[]) start_timer(); while ((bytes = fread(buffer, 1, sizeof(buffer), fp)) > 0) { cmark_parser_feed(parser, buffer, bytes); + if (bytes < sizeof(buffer)) { + break; + } } end_timer("processing lines"); @@ -86,6 +89,9 @@ int main(int argc, char *argv[]) while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0) { cmark_parser_feed(parser, buffer, bytes); + if (bytes < sizeof(buffer)) { + break; + } } } |