For buffer states 0b0000 and 0b1000 we already know that:
used_out is 0
avail_in is 0
used_in is 0
When the code jumps to s1 it will always end up in the same case, executing the
code to handle the stream end, and the function will return from there. So we
can move the code to a new function (nx_stream_end) and call it directly,
returning it's result, avoiding the goto and making the code more readable.
Context: I've been investing some time to try to reorganize nx_deflate to make it easier to keep track of the states, transitions and code flow as whole. But it's requiring too many changes, so it's probably better to do it piece by piece over time instead of all at once. This PR is a small step towards that goal, as was #97
For buffer states 0b0000 and 0b1000 we already know that:
When the code jumps to s1 it will always end up in the same case, executing the code to handle the stream end, and the function will return from there. So we can move the code to a new function (nx_stream_end) and call it directly, returning it's result, avoiding the goto and making the code more readable.
Context: I've been investing some time to try to reorganize
nx_deflate
to make it easier to keep track of the states, transitions and code flow as whole. But it's requiring too many changes, so it's probably better to do it piece by piece over time instead of all at once. This PR is a small step towards that goal, as was #97