Commit bbe6ba7
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 e5884cd commit bbe6ba7
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 | |
|---|---|---|---|
| |||
22817 | 22817 | | |
22818 | 22818 | | |
22819 | 22819 | | |
22820 | | - | |
| 22820 | + | |
22821 | 22821 | | |
22822 | 22822 | | |
22823 | 22823 | | |
| |||
22853 | 22853 | | |
22854 | 22854 | | |
22855 | 22855 | | |
| 22856 | + | |
| 22857 | + | |
| 22858 | + | |
| 22859 | + | |
| 22860 | + | |
| 22861 | + | |
22856 | 22862 | | |
22857 | 22863 | | |
22858 | 22864 | | |
| |||
22888 | 22894 | | |
22889 | 22895 | | |
22890 | 22896 | | |
22891 | | - | |
| 22897 | + | |
22892 | 22898 | | |
22893 | 22899 | | |
22894 | | - | |
| 22900 | + | |
| 22901 | + | |
22895 | 22902 | | |
22896 | 22903 | | |
22897 | 22904 | | |
22898 | 22905 | | |
22899 | 22906 | | |
22900 | | - | |
| 22907 | + | |
22901 | 22908 | | |
22902 | 22909 | | |
22903 | 22910 | | |
| |||
22989 | 22996 | | |
22990 | 22997 | | |
22991 | 22998 | | |
22992 | | - | |
| 22999 | + | |
22993 | 23000 | | |
22994 | 23001 | | |
22995 | 23002 | | |
22996 | 23003 | | |
22997 | 23004 | | |
22998 | | - | |
| 23005 | + | |
22999 | 23006 | | |
23000 | 23007 | | |
23001 | 23008 | | |
| |||
0 commit comments