mirror of
https://github.com/google/brotli.git
synced 2026-07-08 17:56:58 +00:00
Ideas for API improvements #121
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nemequ on GitHub (Jun 22, 2016).
I recently rewrote Squash's brotli extension for the new API. IMHO the API is pretty nice, and I love that it's C not C++. That said, I do have a few ideas for improvements:
is_lastargument toBrotliEncoderWriteMetaBlock), please use abool(or_Boolif you prefer) intsead of anint. Using bool helps make the code more readable and reduce documentation lookups.BrotliEncoder*, but everything in the decoder isBrotli*(e.g.,BrotliStatenotBrotliDecoderState). I think it would be better to move everything in the decoder toBrotliDecoder*_BROTLI_COMMAisn't allowed. C99 (at least, but IIRC C89 too). Anything which starts with an underscore follewed by an uppercase letter or another underscore. In C99, it's in § 7.1.3. I've taken to using an underscore suffix in my code (e.g.,BROTLI_COMMA_) to indicate something is really supposed to be internal.BrotliEncoderMaxCompressedSizecould/should be annotated with the const attribute (GCC ≥ 2.5) or noalias declspec (MSVC, since VC8). Again, Hedley. This one is helpful for optimizing compilers, though honestly I doubt excessive calls toBrotliEncoderMaxCompressedSizeis a performance bottleneck.These are definitely not major issues, I just wanted to bring them up while changing the API is still an option.