Skip to content

Commit 52183b4

Browse files
committed
Make gzip check smaller and inline it
1 parent 44014ce commit 52183b4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/isal/isal_zlibmodule.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,10 @@ static int zlib_mem_level_to_isal(int mem_level) {
123123
return ZLIB_MEM_LEVEL_TO_ISAL[mem_level];
124124
}
125125

126-
static int
126+
static inline int
127127
data_is_gzip(Py_buffer *data){
128-
if (data->len < 2)
129-
return 0;
130128
uint8_t *buf = (uint8_t *)data->buf;
131-
return (buf[0] == 31 && buf[1] == 139);
129+
return (data->len > 1) && (buf[0] == 31) && (buf[1] == 139);
132130
}
133131

134132

0 commit comments

Comments
 (0)