Commit ca6af4a
committed
Refine fgets() to reuse cached line when present
When current() reads a line into the cache without advancing line_num,
a subsequent fgets() would re-read the stream and return the next line,
skipping the cached one and leaving key() out of sync with current()
for the rest of the iteration.
Use the cached line if present; otherwise read a fresh line. Either way,
advance line_num by one.1 parent 0353557 commit ca6af4a
2 files changed
+11
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2096 | 2096 | | |
2097 | 2097 | | |
2098 | 2098 | | |
2099 | | - | |
2100 | | - | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
2101 | 2109 | | |
2102 | | - | |
2103 | | - | |
2104 | 2110 | | |
2105 | 2111 | | |
2106 | 2112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
0 commit comments