zstd - single-file Zstandard decompressor

Upstream:    https://github.com/facebook/zstd
Version:     1.5.7
License:     BSD-3-Clause (see LICENSE; upstream is dual BSD / GPLv2,
             vectra takes it under BSD)
Vendored on: 2026-09-29

Why this lives in vectra/src/zstd/

  ZSTD is one of the common Parquet page codecs (GBIF snapshots, DuckDB and
  Spark exports). tbl_parquet() decodes it through this decoder so the
  package keeps building against nothing but the C runtime.

Files

  zstddeclib.c  - amalgamated decoder, generated by upstream's
                  build/single_file_libs/combine.py (legacy formats
                  excluded, assembly disabled: ZSTD_DISABLE_ASM)
  zstd.h        - public API header (lib/zstd.h)
  zstd_errors.h - error-code header zstd.h includes (lib/zstd_errors.h)
  LICENSE       - BSD license text

How to refresh

  From the upstream release tarball:
    cd build/single_file_libs
    python combine.py -r ../../lib -x legacy/zstd_legacy.h \
        -o zstddeclib.c zstddeclib-in.c
  then copy zstddeclib.c, lib/zstd.h, lib/zstd_errors.h and LICENSE here and
  update the Version line above, then apply the local patch below.

Local patches

  The clang "diagnostic push / ignored -Wzero-as-null-pointer-constant / pop"
  block around ZSTD_defaultCMem is removed from both zstd.h and zstddeclib.c,
  leaving the declaration itself. R CMD check --as-cran reports any pragma
  that suppresses diagnostics, and that warning is a C++ one that C builds
  never enable. After a refresh, check with
    grep -n "diagnostic ignored" zstd.h zstddeclib.c
  which must print nothing.
