Commit ab74c88
committed
qcow-stream-tool: Use tail-recursive functions in read_headers
Otherwise we overflow the stack on large QCOW files:
qcow-stream-tool: internal error, uncaught exception:
Stack overflow
Raised by primitive operation at Dune__exe__Qcow_stream_tool.Impl.read_headers.(fun) in file "ocaml/qcow-stream-tool/qcow_stream_tool.ml", line 23, characters 12-24
Called from Stdlib__List.map in file "list.ml", line 92, characters 32-39
Called from Stdlib__List.map in file "list.ml", line 92, characters 32-39
....
Going through map->seq->list transformations is faster than reversing a list
with List.rev + List.rev_map.
Signed-off-by: Andrii Sultanov <[email protected]>1 parent 1b75c36 commit ab74c88
1 file changed
+6
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | | - | |
18 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
25 | | - | |
| 25 | + | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
0 commit comments