]> git.ipfire.org Git - thirdparty/zstd.git/commit
[lib] Move some ZSTD_CCtx_params off the stack
authorNick Terrell <terrelln@fb.com>
Wed, 5 May 2021 19:41:13 +0000 (12:41 -0700)
committerNick Terrell <terrelln@fb.com>
Wed, 5 May 2021 20:25:16 +0000 (13:25 -0700)
commitc2183d7cdfa9900a2922870cf3fc431e156fa04b
treec011470bb2c1977685973bf8f7b1909e96356670
parent2d10544b84d8d1cffaaffb4ad7233cb295d38371
[lib] Move some ZSTD_CCtx_params off the stack

* Take `params` by const reference in `ZSTD_resetCCtx_internal()`.
* Add `simpleApiParams` to the CCtx and use them in the simple API
  functions, instead of creating those parameters on the stack.

I think this is a good direction to move in, because we shouldn't need
to worry about adding parameters to `ZSTD_CCtx_params`, since it should
always be on the heap (unless they become absoultely gigantic).

Some `ZSTD_CCtx_params` are still on the stack in the CDict functions,
but I've left them for now, because it was a little more complex, and we
don't use those functions in stack-constrained currently.
lib/compress/zstd_compress.c
lib/compress/zstd_compress_internal.h