Skip to content

Commit 2e81175

Browse files
committed
Manipulate pointer instead of returning value
1 parent 4684495 commit 2e81175

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/isal/igzip_lib.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,14 @@ cdef class IgzipDecompressor:
297297
of the unconsumed tail."""
298298
return view_bitbuffer(&self.stream)
299299

300-
cdef unsigned char * decompress_buf(self, Py_ssize_t max_length):
301-
cdef unsigned char * obuf = NULL
300+
cdef decompress_buf(self, Py_ssize_t max_length, unsigned char ** obuf):
301+
obuf[0] = NULL
302302
cdef Py_ssize_t obuflen = DEF_BUF_SIZE_I
303303
cdef int err
304304
if obuflen > max_length:
305305
obuflen = max_length
306306
while True:
307-
obuflen = arrange_output_buffer_with_maximum(&self.stream, &obuf, obuflen, max_length)
307+
obuflen = arrange_output_buffer_with_maximum(&self.stream, obuf, obuflen, max_length)
308308
if obuflen == -1:
309309
raise MemoryError("Unsufficient memory for buffer allocation")
310310
elif obuflen == -2:
@@ -319,7 +319,7 @@ cdef class IgzipDecompressor:
319319
break
320320
elif self.avail_in_real == 0:
321321
break
322-
return obuf
322+
return
323323

324324
def decompress(self, data, Py_ssize_t max_length = -1):
325325
"""
@@ -382,7 +382,7 @@ cdef class IgzipDecompressor:
382382
self.avail_in_real = ibuflen
383383
input_buffer_in_use = 0
384384

385-
obuf = self.decompress_buf(hard_limit)
385+
self.decompress_buf(hard_limit, &obuf)
386386
if obuf == NULL:
387387
self.stream.next_in = NULL
388388
return b""

0 commit comments

Comments
 (0)