Commit 8d15a90
committed
Add an
Checking the return value of `fgets` isn't good enough to determine
whether the input stream has reached EOF or not. `fgets` could have run
in to an error and returned NULL. Additionally, we can't just check the
buffer contents for `\n` because `fgets` could have read the maximum
buffer size (which may not have ended with a `\n`).
I want to use this callback to implement a fix for:
https://bugs.ruby-lang.org/issues/21188feof callback to Prism stream parsing1 parent b35e37b commit 8d15a90
4 files changed
Lines changed: 35 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
994 | 994 | | |
995 | 995 | | |
996 | 996 | | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
997 | 1005 | | |
998 | 1006 | | |
999 | 1007 | | |
| |||
1034 | 1042 | | |
1035 | 1043 | | |
1036 | 1044 | | |
1037 | | - | |
| 1045 | + | |
1038 | 1046 | | |
1039 | 1047 | | |
1040 | 1048 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
90 | 97 | | |
91 | 98 | | |
92 | 99 | | |
93 | 100 | | |
94 | 101 | | |
95 | 102 | | |
96 | 103 | | |
| 104 | + | |
97 | 105 | | |
98 | 106 | | |
99 | 107 | | |
100 | | - | |
| 108 | + | |
101 | 109 | | |
102 | 110 | | |
103 | 111 | | |
| |||
113 | 121 | | |
114 | 122 | | |
115 | 123 | | |
116 | | - | |
| 124 | + | |
117 | 125 | | |
118 | 126 | | |
119 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| 284 | + | |
| 285 | + | |
284 | 286 | | |
285 | 287 | | |
286 | 288 | | |
287 | 289 | | |
288 | 290 | | |
289 | | - | |
| 291 | + | |
290 | 292 | | |
291 | 293 | | |
292 | 294 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22842 | 22842 | | |
22843 | 22843 | | |
22844 | 22844 | | |
22845 | | - | |
| 22845 | + | |
22846 | 22846 | | |
22847 | 22847 | | |
22848 | 22848 | | |
| |||
22878 | 22878 | | |
22879 | 22879 | | |
22880 | 22880 | | |
| 22881 | + | |
| 22882 | + | |
| 22883 | + | |
| 22884 | + | |
| 22885 | + | |
| 22886 | + | |
22881 | 22887 | | |
22882 | 22888 | | |
22883 | 22889 | | |
| |||
22913 | 22919 | | |
22914 | 22920 | | |
22915 | 22921 | | |
22916 | | - | |
| 22922 | + | |
22917 | 22923 | | |
22918 | 22924 | | |
22919 | | - | |
| 22925 | + | |
| 22926 | + | |
22920 | 22927 | | |
22921 | 22928 | | |
22922 | 22929 | | |
22923 | 22930 | | |
22924 | 22931 | | |
22925 | | - | |
| 22932 | + | |
22926 | 22933 | | |
22927 | 22934 | | |
22928 | 22935 | | |
| |||
23014 | 23021 | | |
23015 | 23022 | | |
23016 | 23023 | | |
23017 | | - | |
| 23024 | + | |
23018 | 23025 | | |
23019 | 23026 | | |
23020 | 23027 | | |
23021 | 23028 | | |
23022 | 23029 | | |
23023 | | - | |
| 23030 | + | |
23024 | 23031 | | |
23025 | 23032 | | |
23026 | 23033 | | |
| |||
0 commit comments