X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=plocate-build.cpp;h=ed252fc5a5ac755efb23b6d1ea621d3d28e3cd37;hb=db96666312961f730f7ea9e4a966fc43d73dbc1c;hp=e1e2f644ef2ca891f93d48fdaab15e4f681bf418;hpb=9d1f32d695a463b1f158fc3c0e5a2dd94dcd6987;p=plocate diff --git a/plocate-build.cpp b/plocate-build.cpp index e1e2f64..ed252fc 100644 --- a/plocate-build.cpp +++ b/plocate-build.cpp @@ -300,7 +300,8 @@ string zstd_compress(const string &src, string *tempbuf) if (tempbuf->size() < max_size) { tempbuf->resize(max_size); } - size_t size = ZSTD_compress(&(*tempbuf)[0], max_size, src.data(), src.size(), /*level=*/6); + static ZSTD_CCtx *ctx = ZSTD_createCCtx(); // Reused across calls. + size_t size = ZSTD_compressCCtx(ctx, &(*tempbuf)[0], max_size, src.data(), src.size(), /*level=*/6); return string(tempbuf->data(), size); }