pfalcon / uzlib

Radically unbloated DEFLATE/zlib/gzip compression/decompression library. Can decompress any gzip/zlib data, and offers simplified compressor which produces gzip-compatible output, while requiring much less resources (and providing less compression ratio of course).
Other
306 stars 83 forks source link

No way to associate user data with TINF_DATA instance #7

Closed gnif closed 6 years ago

gnif commented 7 years ago

Unless I am mistaken, when using the readSource callback there is no way to associate data with the instance.

I suggest adding an additional void *opaque on the TINF_DATA structure for this purpose.

pfalcon commented 6 years ago

You can always associate any amount of "user data" using the well-known "embed into your own structure and offset the pointer" pattern (yep, that's not a canonical name of that pattern ;-)).

For reference, you can look at the real-world example of integrating uzlib with MicroPython: https://github.com/micropython/micropython/blob/master/extmod/moduzlib.c#L51