]> git.ipfire.org Git - thirdparty/zstd.git/commit
changed initStatic?Dict() return type to const ZSTD_?Dict*
authorYann Collet <cyan@fb.com>
Wed, 17 Jan 2018 22:08:48 +0000 (14:08 -0800)
committerYann Collet <cyan@fb.com>
Wed, 17 Jan 2018 22:08:48 +0000 (14:08 -0800)
commitf3b8f90b6d7f6b2b00ab07577f77a4a4ec84dab7
tree6b2ac2df332cb365cdcf58a848e1a421e0b50c8f
parent5cde87ca4a3766f5b7c9f71d9846dc858d788acc
changed initStatic?Dict() return type to const ZSTD_?Dict*

ZSTD_create?Dict() is required to produce a ?Dict* return type
because `free()` does not accept a `const type*` argument.
If it wasn't for this restriction, I would have preferred to create a `const ?Dict*` object
to emphasize the fact that, once created, a dictionary never changes
(hence can be shared concurrently until the end of its lifetime).

There is no such limitation with initStatic?Dict() :
as stated in the doc, there is no corresponding free() function,
since `workspace` is provided, hence allocated, externally,
it can only be free() externally.

Which means, ZSTD_initStatic?Dict() can return a `const ZSTD_?Dict*` pointer.

Tested with `make all`, to catch initStatic's users,
which, incidentally, also updated zstd.h documentation.
doc/zstd_manual.html
lib/compress/zstd_compress.c
lib/decompress/zstd_decompress.c
lib/zstd.h
tests/fuzzer.c