Skip to content

Commit 40ccffd

Browse files
committed
More readable NULL byte skipper
1 parent 8034d4e commit 40ccffd

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/isal/isal_zlibmodule.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,17 +1608,14 @@ GzipReader_read_into_buffer(GzipReader *self, uint8_t *out_buffer, size_t out_bu
16081608
self->stream_phase = GzipReader_NULL_BYTES;
16091609
case GzipReader_NULL_BYTES:
16101610
// There maybe NULL bytes between gzip members
1611-
while (current_pos < buffer_end) {
1612-
if (*current_pos != 0) {
1613-
self->stream_phase = GzipReader_HEADER;
1614-
break;
1615-
}
1611+
while (current_pos < buffer_end && *current_pos == 0) {
16161612
current_pos += 1;
16171613
}
1618-
if (current_pos >= buffer_end) {
1614+
if (current_pos == buffer_end) {
1615+
/* Not all NULL bytes may have been read, refresh the buffer.*/
16191616
break;
16201617
}
1621-
// Continue to prevent refreshing the buffer for each block.
1618+
self->stream_phase = GzipReader_HEADER;
16221619
continue;
16231620
default:
16241621
Py_UNREACHABLE();

0 commit comments

Comments
 (0)