extzstd 0.3.2 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -3
  3. data/contrib/zstd/CHANGELOG +225 -1
  4. data/contrib/zstd/CONTRIBUTING.md +158 -75
  5. data/contrib/zstd/LICENSE +4 -4
  6. data/contrib/zstd/Makefile +106 -69
  7. data/contrib/zstd/Package.swift +36 -0
  8. data/contrib/zstd/README.md +64 -36
  9. data/contrib/zstd/SECURITY.md +15 -0
  10. data/contrib/zstd/TESTING.md +2 -3
  11. data/contrib/zstd/lib/BUCK +5 -7
  12. data/contrib/zstd/lib/Makefile +117 -199
  13. data/contrib/zstd/lib/README.md +37 -7
  14. data/contrib/zstd/lib/common/allocations.h +55 -0
  15. data/contrib/zstd/lib/common/bits.h +200 -0
  16. data/contrib/zstd/lib/common/bitstream.h +80 -86
  17. data/contrib/zstd/lib/common/compiler.h +225 -63
  18. data/contrib/zstd/lib/common/cpu.h +37 -1
  19. data/contrib/zstd/lib/common/debug.c +7 -1
  20. data/contrib/zstd/lib/common/debug.h +21 -12
  21. data/contrib/zstd/lib/common/entropy_common.c +15 -37
  22. data/contrib/zstd/lib/common/error_private.c +9 -2
  23. data/contrib/zstd/lib/common/error_private.h +93 -5
  24. data/contrib/zstd/lib/common/fse.h +12 -87
  25. data/contrib/zstd/lib/common/fse_decompress.c +37 -117
  26. data/contrib/zstd/lib/common/huf.h +97 -172
  27. data/contrib/zstd/lib/common/mem.h +58 -58
  28. data/contrib/zstd/lib/common/pool.c +38 -17
  29. data/contrib/zstd/lib/common/pool.h +10 -4
  30. data/contrib/zstd/lib/common/portability_macros.h +158 -0
  31. data/contrib/zstd/lib/common/threading.c +74 -14
  32. data/contrib/zstd/lib/common/threading.h +5 -10
  33. data/contrib/zstd/lib/common/xxhash.c +6 -814
  34. data/contrib/zstd/lib/common/xxhash.h +6930 -195
  35. data/contrib/zstd/lib/common/zstd_common.c +1 -36
  36. data/contrib/zstd/lib/common/zstd_deps.h +1 -1
  37. data/contrib/zstd/lib/common/zstd_internal.h +68 -154
  38. data/contrib/zstd/lib/common/zstd_trace.h +163 -0
  39. data/contrib/zstd/lib/compress/clevels.h +134 -0
  40. data/contrib/zstd/lib/compress/fse_compress.c +75 -155
  41. data/contrib/zstd/lib/compress/hist.c +1 -1
  42. data/contrib/zstd/lib/compress/hist.h +1 -1
  43. data/contrib/zstd/lib/compress/huf_compress.c +810 -259
  44. data/contrib/zstd/lib/compress/zstd_compress.c +2864 -919
  45. data/contrib/zstd/lib/compress/zstd_compress_internal.h +523 -192
  46. data/contrib/zstd/lib/compress/zstd_compress_literals.c +117 -40
  47. data/contrib/zstd/lib/compress/zstd_compress_literals.h +16 -6
  48. data/contrib/zstd/lib/compress/zstd_compress_sequences.c +28 -19
  49. data/contrib/zstd/lib/compress/zstd_compress_sequences.h +1 -1
  50. data/contrib/zstd/lib/compress/zstd_compress_superblock.c +251 -412
  51. data/contrib/zstd/lib/compress/zstd_compress_superblock.h +1 -1
  52. data/contrib/zstd/lib/compress/zstd_cwksp.h +284 -97
  53. data/contrib/zstd/lib/compress/zstd_double_fast.c +382 -133
  54. data/contrib/zstd/lib/compress/zstd_double_fast.h +14 -2
  55. data/contrib/zstd/lib/compress/zstd_fast.c +732 -260
  56. data/contrib/zstd/lib/compress/zstd_fast.h +3 -2
  57. data/contrib/zstd/lib/compress/zstd_lazy.c +1177 -390
  58. data/contrib/zstd/lib/compress/zstd_lazy.h +129 -14
  59. data/contrib/zstd/lib/compress/zstd_ldm.c +280 -210
  60. data/contrib/zstd/lib/compress/zstd_ldm.h +3 -2
  61. data/contrib/zstd/lib/compress/zstd_ldm_geartab.h +106 -0
  62. data/contrib/zstd/lib/compress/zstd_opt.c +516 -285
  63. data/contrib/zstd/lib/compress/zstd_opt.h +32 -8
  64. data/contrib/zstd/lib/compress/zstdmt_compress.c +202 -131
  65. data/contrib/zstd/lib/compress/zstdmt_compress.h +9 -6
  66. data/contrib/zstd/lib/decompress/huf_decompress.c +1149 -555
  67. data/contrib/zstd/lib/decompress/huf_decompress_amd64.S +595 -0
  68. data/contrib/zstd/lib/decompress/zstd_ddict.c +4 -4
  69. data/contrib/zstd/lib/decompress/zstd_ddict.h +1 -1
  70. data/contrib/zstd/lib/decompress/zstd_decompress.c +583 -106
  71. data/contrib/zstd/lib/decompress/zstd_decompress_block.c +1054 -379
  72. data/contrib/zstd/lib/decompress/zstd_decompress_block.h +14 -3
  73. data/contrib/zstd/lib/decompress/zstd_decompress_internal.h +56 -6
  74. data/contrib/zstd/lib/deprecated/zbuff.h +1 -1
  75. data/contrib/zstd/lib/deprecated/zbuff_common.c +1 -1
  76. data/contrib/zstd/lib/deprecated/zbuff_compress.c +24 -4
  77. data/contrib/zstd/lib/deprecated/zbuff_decompress.c +3 -1
  78. data/contrib/zstd/lib/dictBuilder/cover.c +60 -44
  79. data/contrib/zstd/lib/dictBuilder/cover.h +6 -11
  80. data/contrib/zstd/lib/dictBuilder/divsufsort.c +1 -1
  81. data/contrib/zstd/lib/dictBuilder/fastcover.c +26 -18
  82. data/contrib/zstd/lib/dictBuilder/zdict.c +100 -101
  83. data/contrib/zstd/lib/legacy/zstd_legacy.h +38 -1
  84. data/contrib/zstd/lib/legacy/zstd_v01.c +18 -53
  85. data/contrib/zstd/lib/legacy/zstd_v01.h +1 -1
  86. data/contrib/zstd/lib/legacy/zstd_v02.c +28 -85
  87. data/contrib/zstd/lib/legacy/zstd_v02.h +1 -1
  88. data/contrib/zstd/lib/legacy/zstd_v03.c +29 -88
  89. data/contrib/zstd/lib/legacy/zstd_v03.h +1 -1
  90. data/contrib/zstd/lib/legacy/zstd_v04.c +27 -80
  91. data/contrib/zstd/lib/legacy/zstd_v04.h +1 -1
  92. data/contrib/zstd/lib/legacy/zstd_v05.c +36 -85
  93. data/contrib/zstd/lib/legacy/zstd_v05.h +1 -1
  94. data/contrib/zstd/lib/legacy/zstd_v06.c +44 -96
  95. data/contrib/zstd/lib/legacy/zstd_v06.h +1 -1
  96. data/contrib/zstd/lib/legacy/zstd_v07.c +37 -92
  97. data/contrib/zstd/lib/legacy/zstd_v07.h +1 -1
  98. data/contrib/zstd/lib/libzstd.mk +237 -0
  99. data/contrib/zstd/lib/libzstd.pc.in +4 -3
  100. data/contrib/zstd/lib/module.modulemap +35 -0
  101. data/contrib/zstd/lib/{dictBuilder/zdict.h → zdict.h} +202 -33
  102. data/contrib/zstd/lib/zstd.h +1030 -332
  103. data/contrib/zstd/lib/{common/zstd_errors.h → zstd_errors.h} +27 -8
  104. data/ext/extconf.rb +26 -7
  105. data/ext/extzstd.c +51 -24
  106. data/ext/extzstd.h +33 -6
  107. data/ext/extzstd_stream.c +74 -31
  108. data/ext/libzstd_conf.h +0 -1
  109. data/ext/zstd_decompress_asm.S +1 -0
  110. metadata +17 -7
  111. data/contrib/zstd/appveyor.yml +0 -292
  112. data/ext/depend +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4e56ebb5f90203fdb75edc0e6bf0d1a7c52b0cd39eba39fd79e759e61e6d159
4
- data.tar.gz: ebaf4a264c678b3e11951ea7b42ac7338d1d5f1246ec90326a5913bfb9c795ee
3
+ metadata.gz: 5f3831b1c8cc5c106619c27d9d1136868050e35d5cb997d8a06f66bcf9106070
4
+ data.tar.gz: c8824b400e0706d073553eb9a90bb445b1af9d624672d5020acf87d58fcb4524
5
5
  SHA512:
6
- metadata.gz: 4807023d38a23f81780d3a4c3e7b745781d6bb34369f2dda14345e6959df715da1969a6af89e404dc702cfe07d941ecf0d48bad5ea5b91041b8b4f3131239c60
7
- data.tar.gz: 90c90309273506ee9f466efd56fdff168849d0cd5156116b300fc78b48767756c06de8cf37af0a028f63722cd218366d4b581805fb5f05d32898c4ac550ce286
6
+ metadata.gz: dd42f25011a7390206851eccb1e9c515a5245d6634844096bc35342d59d8f3c07f45564dc78efedaafd3846a9c39202ff18821e81bb1da124ace0bca88d7839f
7
+ data.tar.gz: c1f6c98bc5a1b48f4bfe5c17d3fcc04155741c90788d82ac1eec71c27b05177c02ad15bb38a2868b5194e40740e083a9133e1090dd1bb6a63910325d629204ad
data/README.md CHANGED
@@ -91,7 +91,7 @@ p Ractor.new {
91
91
 
92
92
  - package name: extzstd
93
93
  - project page: <https://github.com/dearblue/ruby-extzstd>
94
- - version: 0.3.2
94
+ - version: 0.4
95
95
  - product quality: TECHNICAL PREVIEW, UNSTABLE
96
96
  - license: [2 clause BSD License](LICENSE)
97
97
  - author: dearblue
@@ -99,6 +99,7 @@ p Ractor.new {
99
99
  - dependency ruby gems: (none)
100
100
  - dependency library: (none)
101
101
  - bundled external C library (git submodules):
102
- - [zstd-1.4.9](https://github.com/facebook/zstd/blob/v1.4.9)
103
- under selectable dual licensed ([3 clause BSD License](https://github.com/facebook/zstd/blob/v1.4.9/LICENSE) and [GNU General Public License, version 2](https://github.com/facebook/zstd/blob/v1.4.9/COPYING))
102
+ - [zstd-1.5.6](https://github.com/facebook/zstd/blob/v1.5.6)
103
+ under dual licensed ([3 clause BSD License](https://github.com/facebook/zstd/blob/v1.5.6/LICENSE)
104
+ or [GNU General Public License, version 2](https://github.com/facebook/zstd/blob/v1.5.6/COPYING))
104
105
  by [facebook](https://github.com/facebook)
@@ -1,4 +1,228 @@
1
- v1.4.7
1
+ V1.5.6 (Mar 2024)
2
+ api: Promote `ZSTD_c_targetCBlockSize` to Stable API by @felixhandte
3
+ api: new `ZSTD_d_maxBlockSize` experimental parameter, to reduce streaming decompression memory, by @terrelln
4
+ perf: improve performance of param `ZSTD_c_targetCBlockSize`, by @Cyan4973
5
+ perf: improved compression of arrays of integers at high compression, by @Cyan4973
6
+ lib: reduce binary size with selective built-time exclusion, by @felixhandte
7
+ lib: improved huffman speed on small data and linux kernel, by @terrelln
8
+ lib: accept dictionaries with partial literal tables, by @terrelln
9
+ lib: fix CCtx size estimation with external sequence producer, by @embg
10
+ lib: fix corner case decoder behaviors, by @Cyan4973 and @aimuz
11
+ lib: fix zdict prototype mismatch in static_only mode, by @ldv-alt
12
+ lib: fix several bugs in magicless-format decoding, by @embg
13
+ cli: add common compressed file types to `--exclude-compressed`` by @daniellerozenblit
14
+ cli: fix mixing `-c` and `-o` commands with `--rm`, by @Cyan4973
15
+ cli: fix erroneous exclusion of hidden files with `--output-dir-mirror` by @felixhandte
16
+ cli: improved time accuracy on BSD, by @felixhandte
17
+ cli: better errors on argument parsing, by @KapJI
18
+ tests: better compatibility with older versions of `grep`, by @Cyan4973
19
+ tests: lorem ipsum generator as default backup content, by @Cyan4973
20
+ build: cmake improvements by @terrelln, @sighingnow, @gjasny, @JohanMabille, @Saverio976, @gruenich, @teo-tsirpanis
21
+ build: bazel support, by @jondo2010
22
+ build: fix cross-compiling for AArch64 with lld by @jcelerier
23
+ build: fix Apple platform compatibility, by @nidhijaju
24
+ build: fix Visual 2012 and lower compatibility, by @Cyan4973
25
+ build: improve win32 support, by @DimitriPapadopoulos
26
+ build: better C90 compliance for zlibWrapper, by @emaste
27
+ port: make: fat binaries on macos, by @mredig
28
+ port: ARM64EC compatibility for Windows, by @dunhor
29
+ port: QNX support by @klausholstjacobsen
30
+ port: MSYS2 and Cygwin makefile installation and test support, by @QBos07
31
+ port: risc-v support validation in CI, by @Cyan4973
32
+ port: sparc64 support validation in CI, by @Cyan4973
33
+ port: AIX compatibility, by @likema
34
+ port: HP-UX compatibility, by @likema
35
+ doc: Improved specification accuracy, by @elasota
36
+ bug: Fix and deprecate ZSTD_generateSequences (#3981)
37
+
38
+ v1.5.5 (Apr 2023)
39
+ fix: fix rare corruption bug affecting the high compression mode, reported by @danlark1 (#3517, @terrelln)
40
+ perf: improve mid-level compression speed (#3529, #3533, #3543, @yoniko and #3552, @terrelln)
41
+ lib: deprecated bufferless block-level API (#3534) by @terrelln
42
+ cli: mmap large dictionaries to save memory, by @daniellerozenblit
43
+ cli: improve speed of --patch-from mode (~+50%) (#3545) by @daniellerozenblit
44
+ cli: improve i/o speed (~+10%) when processing lots of small files (#3479) by @felixhandte
45
+ cli: zstd no longer crashes when requested to write into write-protected directory (#3541) by @felixhandte
46
+ cli: fix decompression into block device using -o, reported by @georgmu (#3583)
47
+ build: fix zstd CLI compiled with lzma support but not zlib support (#3494) by @Hello71
48
+ build: fix cmake does no longer require 3.18 as minimum version (#3510) by @kou
49
+ build: fix MSVC+ClangCL linking issue (#3569) by @tru
50
+ build: fix zstd-dll, version of zstd CLI that links to the dynamic library (#3496) by @yoniko
51
+ build: fix MSVC warnings (#3495) by @embg
52
+ doc: updated zstd specification to clarify corner cases, by @Cyan4973
53
+ doc: document how to create fat binaries for macos (#3568) by @rickmark
54
+ misc: improve seekable format ingestion speed (~+100%) for very small chunk sizes (#3544) by @Cyan4973
55
+ misc: tests/fullbench can benchmark multiple files (#3516) by @dloidolt
56
+
57
+ v1.5.4 (Feb 2023)
58
+ perf: +20% faster huffman decompression for targets that can't compile x64 assembly (#3449, @terrelln)
59
+ perf: up to +10% faster streaming compression at levels 1-2 (#3114, @embg)
60
+ perf: +4-13% for levels 5-12 by optimizing function generation (#3295, @terrelln)
61
+ pref: +3-11% compression speed for `arm` target (#3199, #3164, #3145, #3141, #3138, @JunHe77 and #3139, #3160, @danlark1)
62
+ perf: +5-30% faster dictionary compression at levels 1-4 (#3086, #3114, #3152, @embg)
63
+ perf: +10-20% cold dict compression speed by prefetching CDict tables (#3177, @embg)
64
+ perf: +1% faster compression by removing a branch in ZSTD_fast_noDict (#3129, @felixhandte)
65
+ perf: Small compression ratio improvements in high compression mode (#2983, #3391, @Cyan4973 and #3285, #3302, @daniellerozenblit)
66
+ perf: small speed improvement by better detecting `STATIC_BMI2` for `clang` (#3080, @TocarIP)
67
+ perf: Improved streaming performance when `ZSTD_c_stableInBuffer` is set (#2974, @Cyan4973)
68
+ cli: Asynchronous I/O for improved cli speed (#2975, #2985, #3021, #3022, @yoniko)
69
+ cli: Change `zstdless` behavior to align with `zless` (#2909, @binhdvo)
70
+ cli: Keep original file if `-c` or `--stdout` is given (#3052, @dirkmueller)
71
+ cli: Keep original files when result is concatenated into a single output with `-o` (#3450, @Cyan4973)
72
+ cli: Preserve Permissions and Ownership of regular files (#3432, @felixhandte)
73
+ cli: Print zlib/lz4/lzma library versions with `-vv` (#3030, @terrelln)
74
+ cli: Print checksum value for single frame files with `-lv` (#3332, @Cyan4973)
75
+ cli: Print `dictID` when present with `-lv` (#3184, @htnhan)
76
+ cli: when `stderr` is *not* the console, disable status updates, but preserve final summary (#3458, @Cyan4973)
77
+ cli: support `--best` and `--no-name` in `gzip` compatibility mode (#3059, @dirkmueller)
78
+ cli: support for `posix` high resolution timer `clock_gettime()`, for improved benchmark accuracy (#3423, @Cyan4973)
79
+ cli: improved help/usage (`-h`, `-H`) formatting (#3094, @dirkmueller and #3385, @jonpalmisc)
80
+ cli: Fix better handling of bogus numeric values (#3268, @ctkhanhly)
81
+ cli: Fix input consists of multiple files _and_ `stdin` (#3222, @yoniko)
82
+ cli: Fix tiny files passthrough (#3215, @cgbur)
83
+ cli: Fix for `-r` on empty directory (#3027, @brailovich)
84
+ cli: Fix empty string as argument for `--output-dir-*` (#3220, @embg)
85
+ cli: Fix decompression memory usage reported by `-vv --long` (#3042, @u1f35c, and #3232, @zengyijing)
86
+ cli: Fix infinite loop when empty input is passed to trainer (#3081, @terrelln)
87
+ cli: Fix `--adapt` doesn't work when `--no-progress` is also set (#3354, @terrelln)
88
+ api: Support for Block-Level Sequence Producer (#3333, @embg)
89
+ api: Support for in-place decompression (#3432, @terrelln)
90
+ api: New `ZSTD_CCtx_setCParams()` function, set all parameters defined in a `ZSTD_compressionParameters` structure (#3403, @Cyan4973)
91
+ api: Streaming decompression detects incorrect header ID sooner (#3175, @Cyan4973)
92
+ api: Window size resizing optimization for edge case (#3345, @daniellerozenblit)
93
+ api: More accurate error codes for busy-loop scenarios (#3413, #3455, @Cyan4973)
94
+ api: Fix limit overflow in `compressBound` and `decompressBound` (#3362, #3373, Cyan4973) reported by @nigeltao
95
+ api: Deprecate several advanced experimental functions: streaming (#3408, @embg), copy (#3196, @mileshu)
96
+ bug: Fix corruption that rarely occurs in 32-bit mode with wlog=25 (#3361, @terrelln)
97
+ bug: Fix for block-splitter (#3033, @Cyan4973)
98
+ bug: Fixes for Sequence Compression API (#3023, #3040, @Cyan4973)
99
+ bug: Fix leaking thread handles on Windows (#3147, @animalize)
100
+ bug: Fix timing issues with cmake/meson builds (#3166, #3167, #3170, @Cyan4973)
101
+ build: Allow user to select legacy level for cmake (#3050, @shadchin)
102
+ build: Enable legacy support by default in cmake (#3079, @niamster)
103
+ build: Meson build script improvements (#3039, #3120, #3122, #3327, #3357, @eli-schwartz and #3276, @neheb)
104
+ build: Add aarch64 to supported architectures for zstd_trace (#3054, @ooosssososos)
105
+ build: support AIX architecture (#3219, @qiongsiwu)
106
+ build: Fix `ZSTD_LIB_MINIFY` build macro, which now reduces static library size by half (#3366, @terrelln)
107
+ build: Fix Windows issues with Multithreading translation layer (#3364, #3380, @yoniko) and ARM64 target (#3320, @cwoffenden)
108
+ build: Fix `cmake` script (#3382, #3392, @terrelln and #3252 @Tachi107 and #3167 @Cyan4973)
109
+ doc: Updated man page, providing more details for `--train` mode (#3112, @Cyan4973)
110
+ doc: Add decompressor errata document (#3092, @terrelln)
111
+ misc: Enable Intel CET (#2992, #2994, @hjl-tools)
112
+ misc: Fix `contrib/` seekable format (#3058, @yhoogstrate and #3346, @daniellerozenblit)
113
+ misc: Improve speed of the one-file library generator (#3241, @wahern and #3005, @cwoffenden)
114
+
115
+ v1.5.3 (dev version, unpublished)
116
+
117
+ v1.5.2 (Jan, 2022)
118
+ perf: Regain Minimal memset()-ing During Reuse of Compression Contexts (@Cyan4973, #2969)
119
+ build: Build Zstd with `noexecstack` on All Architectures (@felixhandte, #2964)
120
+ doc: Clarify Licensing (@terrelln, #2981)
121
+
122
+ v1.5.1 (Dec, 2021)
123
+ perf: rebalanced compression levels, to better match the intended speed/level curve, by @senhuang42
124
+ perf: faster huffman decoder, using x64 assembly, by @terrelln
125
+ perf: slightly faster high speed modes (strategies fast & dfast), by @felixhandte
126
+ perf: improved binary size and faster compilation times, by @terrelln
127
+ perf: new row64 mode, used notably in level 12, by @senhuang42
128
+ perf: faster mid-level compression speed in presence of highly repetitive patterns, by @senhuang42
129
+ perf: minor compression ratio improvements for small data at high levels, by @cyan4973
130
+ perf: reduced stack usage (mostly useful for Linux Kernel), by @terrelln
131
+ perf: faster compression speed on incompressible data, by @bindhvo
132
+ perf: on-demand reduced ZSTD_DCtx state size, using build macro ZSTD_DECODER_INTERNAL_BUFFER, at a small cost of performance, by @bindhvo
133
+ build: allows hiding static symbols in the dynamic library, using build macro, by @skitt
134
+ build: support for m68k (Motorola 68000's), by @cyan4973
135
+ build: improved AIX support, by @Helflym
136
+ build: improved meson unofficial build, by @eli-schwartz
137
+ cli : custom memory limit when training dictionary (#2925), by @embg
138
+ cli : report advanced parameters information when compressing in very verbose mode (`-vv`), by @Svetlitski-FB
139
+
140
+ v1.5.0 (May 11, 2021)
141
+ api: Various functions promoted from experimental to stable API: (#2579-2581, @senhuang42)
142
+ `ZSTD_defaultCLevel()`
143
+ `ZSTD_getDictID_fromCDict()`
144
+ api: Several experimental functions have been deprecated and will emit a compiler warning (#2582, @senhuang42)
145
+ `ZSTD_compress_advanced()`
146
+ `ZSTD_compress_usingCDict_advanced()`
147
+ `ZSTD_compressBegin_advanced()`
148
+ `ZSTD_compressBegin_usingCDict_advanced()`
149
+ `ZSTD_initCStream_srcSize()`
150
+ `ZSTD_initCStream_usingDict()`
151
+ `ZSTD_initCStream_usingCDict()`
152
+ `ZSTD_initCStream_advanced()`
153
+ `ZSTD_initCStream_usingCDict_advanced()`
154
+ `ZSTD_resetCStream()`
155
+ api: ZSTDMT_NBWORKERS_MAX reduced to 64 for 32-bit environments (@Cyan4973)
156
+ perf: Significant speed improvements for middle compression levels (#2494, @senhuang42 @terrelln)
157
+ perf: Block splitter to improve compression ratio, enabled by default for high compression levels (#2447, @senhuang42)
158
+ perf: Decompression loop refactor, speed improvements on `clang` and for `--long` modes (#2614 #2630, @Cyan4973)
159
+ perf: Reduced stack usage during compression and decompression entropy stage (#2522 #2524, @terrelln)
160
+ bug: Improve setting permissions of created files (#2525, @felixhandte)
161
+ bug: Fix large dictionary non-determinism (#2607, @terrelln)
162
+ bug: Fix non-determinism test failures on Linux i686 (#2606, @terrelln)
163
+ bug: Fix various dedicated dictionary search bugs (#2540 #2586, @senhuang42 @felixhandte)
164
+ bug: Ensure `ZSTD_estimateCCtxSize*() `monotonically increases with compression level (#2538, @senhuang42)
165
+ bug: Fix --patch-from mode parameter bound bug with small files (#2637, @occivink)
166
+ bug: Fix UBSAN error in decompression (#2625, @terrelln)
167
+ bug: Fix superblock compression divide by zero bug (#2592, @senhuang42)
168
+ bug: Make the number of physical CPU cores detection more robust (#2517, @PaulBone)
169
+ doc: Improve `zdict.h` dictionary training API documentation (#2622, @terrelln)
170
+ doc: Note that public `ZSTD_free*()` functions accept NULL pointers (#2521, @animalize)
171
+ doc: Add style guide docs for open source contributors (#2626, @Cyan4973)
172
+ tests: Better regression test coverage for different dictionary modes (#2559, @senhuang42)
173
+ tests: Better test coverage of index reduction (#2603, @terrelln)
174
+ tests: OSS-Fuzz coverage for seekable format (#2617, @senhuang42)
175
+ tests: Test coverage for ZSTD threadpool API (#2604, @senhuang42)
176
+ build: Dynamic library built multithreaded by default (#2584, @senhuang42)
177
+ build: Move `zstd_errors.h` and `zdict.h` to `lib/` root (#2597, @terrelln)
178
+ build: Allow `ZSTDMT_JOBSIZE_MIN` to be configured at compile-time, reduce default to 512KB (#2611, @Cyan4973)
179
+ build: Single file library build script moved to `build/` directory (#2618, @felixhandte)
180
+ build: `ZBUFF_*()` is no longer built by default (#2583, @senhuang42)
181
+ build: Fixed Meson build (#2548, @SupervisedThinking @kloczek)
182
+ build: Fix excessive compiler warnings with clang-cl and CMake (#2600, @nickhutchinson)
183
+ build: Detect presence of `md5` on Darwin (#2609, @felixhandte)
184
+ build: Avoid SIGBUS on armv6 (#2633, @bmwiedmann)
185
+ cli: `--progress` flag added to always display progress bar (#2595, @senhuang42)
186
+ cli: Allow reading from block devices with `--force` (#2613, @felixhandte)
187
+ cli: Fix CLI filesize display bug (#2550, @Cyan4973)
188
+ cli: Fix windows CLI `--filelist` end-of-line bug (#2620, @Cyan4973)
189
+ contrib: Various fixes for linux kernel patch (#2539, @terrelln)
190
+ contrib: Seekable format - Decompression hanging edge case fix (#2516, @senhuang42)
191
+ contrib: Seekable format - New seek table-only API (#2113 #2518, @mdittmer @Cyan4973)
192
+ contrib: Seekable format - Fix seek table descriptor check when loading (#2534, @foxeng)
193
+ contrib: Seekable format - Decompression fix for large offsets, (#2594, @azat)
194
+ misc: Automatically published release tarballs available on Github (#2535, @felixhandte)
195
+
196
+ v1.4.9 (Mar 1, 2021)
197
+ bug: Use `umask()` to Constrain Created File Permissions (#2495, @felixhandte)
198
+ bug: Make Simple Single-Pass Functions Ignore Advanced Parameters (#2498, @terrelln)
199
+ api: Add (De)Compression Tracing Functionality (#2482, @terrelln)
200
+ api: Support References to Multiple DDicts (#2446, @senhuang42)
201
+ api: Add Function to Generate Skippable Frame (#2439, @senhuang42)
202
+ perf: New Algorithms for the Long Distance Matcher (#2483, @mpu)
203
+ perf: Performance Improvements for Long Distance Matcher (#2464, @mpu)
204
+ perf: Don't Shrink Window Log when Streaming with a Dictionary (#2451, @terrelln)
205
+ cli: Fix `--output-dir-mirror` rejection of `..` -containing paths (#2512, @felixhandte)
206
+ cli: Allow Input From Console When `-f`/`--force` is Passed (#2466, @felixhandte)
207
+ cli: Improve Help Message (#2500, @senhuang42)
208
+ tests: Remove Flaky Tests (#2455, #2486, #2445, @Cyan4973)
209
+ tests: Correctly Invoke md5 Utility on NetBSD (#2492, @niacat)
210
+ tests: Avoid Using `stat -c` on NetBSD (#2513, @felixhandte)
211
+ build: Zstd CLI Can Now be Linked to Dynamic `libzstd` (#2457, #2454 @Cyan4973)
212
+ build: Hide and Avoid Using Static-Only Symbols (#2501, #2504, @skitt)
213
+ build: CMake: Enable Only C for lib/ and programs/ Projects (#2498, @concatime)
214
+ build: CMake: Use `configure_file()` to Create the `.pc` File (#2462, @lazka)
215
+ build: Fix Fuzzer Compiler Detection & Update UBSAN Flags (#2503, @terrelln)
216
+ build: Add Guards for `_LARGEFILE_SOURCE` and `_LARGEFILE64_SOURCE` (#2444, @indygreg)
217
+ build: Improve `zlibwrapper` Makefile (#2437, @Cyan4973)
218
+ contrib: Add `recover_directory` Program (#2473, @terrelln)
219
+ doc: Change License Year to 2021 (#2452 & #2465, @terrelln & @senhuang42)
220
+ doc: Fix Typos (#2459, @ThomasWaldmann)
221
+
222
+ v1.4.8 (Dec 18, 2020)
223
+ hotfix: wrong alignment of an internal buffer
224
+
225
+ v1.4.7 (Dec 16, 2020)
2
226
  perf: stronger --long mode at high compression levels, by @senhuang42
3
227
  perf: stronger --patch-from at high compression levels, thanks to --long improvements
4
228
  perf: faster dictionary compression at medium compression levels, by @felixhandte
@@ -5,9 +5,9 @@ possible.
5
5
  ## Our Development Process
6
6
  New versions are being developed in the "dev" branch,
7
7
  or in their own feature branch.
8
- When they are deemed ready for a release, they are merged into "master".
8
+ When they are deemed ready for a release, they are merged into "release".
9
9
 
10
- As a consequences, all contributions must stage first through "dev"
10
+ As a consequence, all contributions must stage first through "dev"
11
11
  or their own feature branch.
12
12
 
13
13
  ## Pull Requests
@@ -47,7 +47,7 @@ Our contribution process works in three main stages:
47
47
  * Topic and development:
48
48
  * Make a new branch on your fork about the topic you're developing for
49
49
  ```
50
- # branch names should be consise but sufficiently informative
50
+ # branch names should be concise but sufficiently informative
51
51
  git checkout -b <branch-name>
52
52
  git push origin <branch-name>
53
53
  ```
@@ -68,8 +68,8 @@ Our contribution process works in three main stages:
68
68
  ```
69
69
  2. Code Review and CI tests
70
70
  * Ensure CI tests pass:
71
- * Before sharing anything to the community, make sure that all CI tests pass on your local fork.
72
- See our section on setting up your CI environment for more information on how to do this.
71
+ * Before sharing anything to the community, create a pull request in your own fork against the dev branch
72
+ and make sure that all GitHub Actions CI tests pass. See the Continuous Integration section below for more information.
73
73
  * Ensure that static analysis passes on your development machine. See the Static Analysis section
74
74
  below to see how to do this.
75
75
  * Create a pull request:
@@ -104,7 +104,7 @@ Our contribution process works in three main stages:
104
104
  issue at hand, then please indicate this by requesting that an issue be closed by commenting.
105
105
  * Just because your changes have been merged does not mean the topic or larger issue is complete. Remember
106
106
  that the change must make it to an official zstd release for it to be meaningful. We recommend
107
- that contributers track the activity on their pull request and corresponding issue(s) page(s) until
107
+ that contributors track the activity on their pull request and corresponding issue(s) page(s) until
108
108
  their change makes it to the next release of zstd. Users will often discover bugs in your code or
109
109
  suggest ways to refine and improve your initial changes even after the pull request is merged.
110
110
 
@@ -134,11 +134,47 @@ It can be useful to look at additional static analyzers once in a while (and we
134
134
  - Static analyzers are full of false positive. The signal to noise ratio is actually pretty low.
135
135
  - A good CI policy is "zero-warning tolerance". That means that all issues must be solved, including false positives. This quickly becomes a tedious workload.
136
136
  - Multiple static analyzers will feature multiple kind of false positives, sometimes applying to the same code but in different ways leading to :
137
- + torteous code, trying to please multiple constraints, hurting readability and therefore maintenance. Sometimes, such complexity introduce other more subtle bugs, that are just out of scope of the analyzers.
137
+ + tortuous code, trying to please multiple constraints, hurting readability and therefore maintenance. Sometimes, such complexity introduce other more subtle bugs, that are just out of scope of the analyzers.
138
138
  + sometimes, these constraints are mutually exclusive : if one try to solve one, the other static analyzer will complain, they can't be both happy at the same time.
139
139
  - As if that was not enough, the list of false positives change with each version. It's hard enough to follow one static analyzer, but multiple ones with their own update agenda, this quickly becomes a massive velocity reducer.
140
140
 
141
- This is different from running a static analyzer once in a while, looking at the output, and __cherry picking__ a few warnings that seem helpful, either because they detected a genuine risk of bug, or because it helps expressing the code in a way which is more readable or more difficult to misuse. These kind of reports can be useful, and are accepted.
141
+ This is different from running a static analyzer once in a while, looking at the output, and __cherry picking__ a few warnings that seem helpful, either because they detected a genuine risk of bug, or because it helps expressing the code in a way which is more readable or more difficult to misuse. These kinds of reports can be useful, and are accepted.
142
+
143
+ ## Continuous Integration
144
+ CI tests run every time a pull request (PR) is created or updated. The exact tests
145
+ that get run will depend on the destination branch you specify. Some tests take
146
+ longer to run than others. Currently, our CI is set up to run a short
147
+ series of tests when creating a PR to the dev branch and a longer series of tests
148
+ when creating a PR to the release branch. You can look in the configuration files
149
+ of the respective CI platform for more information on what gets run when.
150
+
151
+ Most people will just want to create a PR with the destination set to their local dev
152
+ branch of zstd. You can then find the status of the tests on the PR's page. You can also
153
+ re-run tests and cancel running tests from the PR page or from the respective CI's dashboard.
154
+
155
+ Almost all of zstd's CI runs on GitHub Actions (configured at `.github/workflows`), which will automatically run on PRs to your
156
+ own fork. A small number of tests run on other services (e.g. Travis CI, Circle CI, Appveyor).
157
+ These require work to set up on your local fork, and (at least for Travis CI) cost money.
158
+ Therefore, if the PR on your local fork passes GitHub Actions, feel free to submit a PR
159
+ against the main repo.
160
+
161
+ ### Third-party CI
162
+ A small number of tests cannot run on GitHub Actions, or have yet to be migrated.
163
+ For these, we use a variety of third-party services (listed below). It is not necessary to set
164
+ these up on your fork in order to contribute to zstd; however, we do link to instructions for those
165
+ who want earlier signal.
166
+
167
+ | Service | Purpose | Setup Links | Config Path |
168
+ |-----------|------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------|
169
+ | Travis CI | Used for testing on non-x86 architectures such as PowerPC | https://docs.travis-ci.com/user/tutorial/#to-get-started-with-travis-ci-using-github <br> https://github.com/marketplace/travis-ci | `.travis.yml` |
170
+ | AppVeyor | Used for some Windows testing (e.g. cygwin, mingw) | https://www.appveyor.com/blog/2018/10/02/github-apps-integration/ <br> https://github.com/marketplace/appveyor | `appveyor.yml` |
171
+ | Cirrus CI | Used for testing on FreeBSD | https://github.com/marketplace/cirrus-ci/ | `.cirrus.yml` |
172
+ | Circle CI | Historically was used to provide faster signal,<br/> but we may be able to migrate these to Github Actions | https://circleci.com/docs/2.0/getting-started/#setting-up-circleci <br> https://youtu.be/Js3hMUsSZ2c <br> https://circleci.com/docs/2.0/enable-checks/ | `.circleci/config.yml` |
173
+
174
+ Note: the instructions linked above mostly cover how to set up a repository with CI from scratch.
175
+ The general idea should be the same for setting up CI on your fork of zstd, but you may have to
176
+ follow slightly different steps. In particular, please ignore any instructions related to setting up
177
+ config files (since zstd already has configs for each of these services).
142
178
 
143
179
  ## Performance
144
180
  Performance is extremely important for zstd and we only merge pull requests whose performance
@@ -161,7 +197,7 @@ something subtle merged is extensive benchmarking. You will be doing us a great
161
197
  take the time to run extensive, long-duration, and potentially cross-(os, platform, process, etc)
162
198
  benchmarks on your end before submitting a PR. Of course, you will not be able to benchmark
163
199
  your changes on every single processor and os out there (and neither will we) but do that best
164
- you can:) We've adding some things to think about when benchmarking below in the Benchmarking
200
+ you can:) We've added some things to think about when benchmarking below in the Benchmarking
165
201
  Performance section which might be helpful for you.
166
202
  3. Optimizing performance for a certain OS, processor vendor, compiler, or network system is a perfectly
167
203
  legitimate thing to do as long as it does not harm the overall performance health of Zstd.
@@ -180,7 +216,7 @@ will typically not be stable enough to obtain reliable benchmark results. If you
180
216
  hands on a desktop, this is usually a better scenario.
181
217
 
182
218
  Of course, benchmarking can be done on non-hyper-stable machines as well. You will just have to
183
- do a little more work to ensure that you are in fact measuring the changes you've made not and
219
+ do a little more work to ensure that you are in fact measuring the changes you've made and not
184
220
  noise. Here are some things you can do to make your benchmarks more stable:
185
221
 
186
222
  1. The most simple thing you can do to drastically improve the stability of your benchmark is
@@ -237,7 +273,7 @@ for that options you have just provided. If you want to look at the internals of
237
273
  benchmarking script works, you can check out programs/benchzstd.c
238
274
 
239
275
  For example: say you have made a change that you believe improves the speed of zstd level 1. The
240
- very first thing you should use to asses whether you actually achieved any sort of improvement
276
+ very first thing you should use to assess whether you actually achieved any sort of improvement
241
277
  is `zstd -b`. You might try to do something like this. Note: you can use the `-i` option to
242
278
  specify a running time for your benchmark in seconds (default is 3 seconds).
243
279
  Usually, the longer the running time, the more stable your results will be.
@@ -263,24 +299,24 @@ this method of evaluation will not be sufficient.
263
299
  ### Profiling
264
300
  There are a number of great profilers out there. We're going to briefly mention how you can
265
301
  profile your code using `instruments` on mac, `perf` on linux and `visual studio profiler`
266
- on windows.
302
+ on Windows.
267
303
 
268
304
  Say you have an idea for a change that you think will provide some good performance gains
269
305
  for level 1 compression on Zstd. Typically this means, you have identified a section of
270
306
  code that you think can be made to run faster.
271
307
 
272
308
  The first thing you will want to do is make sure that the piece of code is actually taking up
273
- a notable amount of time to run. It is usually not worth optimzing something which accounts for less than
309
+ a notable amount of time to run. It is usually not worth optimizing something which accounts for less than
274
310
  0.0001% of the total running time. Luckily, there are tools to help with this.
275
311
  Profilers will let you see how much time your code spends inside a particular function.
276
- If your target code snippit is only part of a function, it might be worth trying to
277
- isolate that snippit by moving it to its own function (this is usually not necessary but
312
+ If your target code snippet is only part of a function, it might be worth trying to
313
+ isolate that snippet by moving it to its own function (this is usually not necessary but
278
314
  might be).
279
315
 
280
- Most profilers (including the profilers dicusssed below) will generate a call graph of
281
- functions for you. Your goal will be to find your function of interest in this call grapch
282
- and then inspect the time spent inside of it. You might also want to to look at the
283
- annotated assembly which most profilers will provide you with.
316
+ Most profilers (including the profilers discussed below) will generate a call graph of
317
+ functions for you. Your goal will be to find your function of interest in this call graph
318
+ and then inspect the time spent inside of it. You might also want to look at the annotated
319
+ assembly which most profilers will provide you with.
284
320
 
285
321
  #### Instruments
286
322
  We will once again consider the scenario where you think you've identified a piece of code
@@ -294,23 +330,23 @@ Instruments.
294
330
  * You will want a benchmark that runs for at least a few seconds (5 seconds will
295
331
  usually be long enough). This way the profiler will have something to work with
296
332
  and you will have ample time to attach your profiler to this process:)
297
- * I will just use benchzstd as my bencharmking script for this example:
333
+ * I will just use benchzstd as my benchmarmking script for this example:
298
334
  ```
299
335
  $ zstd -b1 -i5 <my-data> # this will run for 5 seconds
300
336
  ```
301
337
  5. Once you run your benchmarking script, switch back over to instruments and attach your
302
338
  process to the time profiler. You can do this by:
303
339
  * Clicking on the `All Processes` drop down in the top left of the toolbar.
304
- * Selecting your process from the dropdown. In my case, it is just going to be labled
340
+ * Selecting your process from the dropdown. In my case, it is just going to be labeled
305
341
  `zstd`
306
342
  * Hitting the bright red record circle button on the top left of the toolbar
307
- 6. You profiler will now start collecting metrics from your bencharking script. Once
343
+ 6. You profiler will now start collecting metrics from your benchmarking script. Once
308
344
  you think you have collected enough samples (usually this is the case after 3 seconds of
309
345
  recording), stop your profiler.
310
346
  7. Make sure that in toolbar of the bottom window, `profile` is selected.
311
347
  8. You should be able to see your call graph.
312
348
  * If you don't see the call graph or an incomplete call graph, make sure you have compiled
313
- zstd and your benchmarking scripg using debug flags. On mac and linux, this just means
349
+ zstd and your benchmarking script using debug flags. On mac and linux, this just means
314
350
  you will have to supply the `-g` flag alone with your build script. You might also
315
351
  have to provide the `-fno-omit-frame-pointer` flag
316
352
  9. Dig down the graph to find your function call and then inspect it by double clicking
@@ -329,7 +365,7 @@ Some general notes on perf:
329
365
  counter statistics. Perf uses a high resolution timer and this is likely one
330
366
  of the first things your team will run when assessing your PR.
331
367
  * Perf has a long list of hardware counters that can be viewed with `perf --list`.
332
- When measuring optimizations, something worth trying is to make sure the handware
368
+ When measuring optimizations, something worth trying is to make sure the hardware
333
369
  counters you expect to be impacted by your change are in fact being so. For example,
334
370
  if you expect the L1 cache misses to decrease with your change, you can look at the
335
371
  counter `L1-dcache-load-misses`
@@ -339,57 +375,6 @@ counter `L1-dcache-load-misses`
339
375
 
340
376
  TODO
341
377
 
342
-
343
- ## Setting up continuous integration (CI) on your fork
344
- Zstd uses a number of different continuous integration (CI) tools to ensure that new changes
345
- are well tested before they make it to an official release. Specifically, we use the platforms
346
- travis-ci, circle-ci, and appveyor.
347
-
348
- Changes cannot be merged into the main dev branch unless they pass all of our CI tests.
349
- The easiest way to run these CI tests on your own before submitting a PR to our dev branch
350
- is to configure your personal fork of zstd with each of the CI platforms. Below, you'll find
351
- instructions for doing this.
352
-
353
- ### travis-ci
354
- Follow these steps to link travis-ci with your github fork of zstd
355
-
356
- 1. Make sure you are logged into your github account
357
- 2. Go to https://travis-ci.org/
358
- 3. Click 'Sign in with Github' on the top right
359
- 4. Click 'Authorize travis-ci'
360
- 5. Click 'Activate all repositories using Github Apps'
361
- 6. Select 'Only select repositories' and select your fork of zstd from the drop down
362
- 7. Click 'Approve and Install'
363
- 8. Click 'Sign in with Github' again. This time, it will be for travis-pro (which will let you view your tests on the web dashboard)
364
- 9. Click 'Authorize travis-pro'
365
- 10. You should have travis set up on your fork now.
366
-
367
- ### circle-ci
368
- TODO
369
-
370
- ### appveyor
371
- Follow these steps to link circle-ci with your girhub fork of zstd
372
-
373
- 1. Make sure you are logged into your github account
374
- 2. Go to https://www.appveyor.com/
375
- 3. Click 'Sign in' on the top right
376
- 4. Select 'Github' on the left panel
377
- 5. Click 'Authorize appveyor'
378
- 6. You might be asked to select which repositories you want to give appveyor permission to. Select your fork of zstd if you're prompted
379
- 7. You should have appveyor set up on your fork now.
380
-
381
- ### General notes on CI
382
- CI tests run every time a pull request (PR) is created or updated. The exact tests
383
- that get run will depend on the destination branch you specify. Some tests take
384
- longer to run than others. Currently, our CI is set up to run a short
385
- series of tests when creating a PR to the dev branch and a longer series of tests
386
- when creating a PR to the master branch. You can look in the configuration files
387
- of the respective CI platform for more information on what gets run when.
388
-
389
- Most people will just want to create a PR with the destination set to their local dev
390
- branch of zstd. You can then find the status of the tests on the PR's page. You can also
391
- re-run tests and cancel running tests from the PR page or from the respective CI's dashboard.
392
-
393
378
  ## Issues
394
379
  We use GitHub issues to track public bugs. Please ensure your description is
395
380
  clear and has sufficient instructions to be able to reproduce the issue.
@@ -399,7 +384,105 @@ disclosure of security bugs. In those cases, please go through the process
399
384
  outlined on that page and do not file a public issue.
400
385
 
401
386
  ## Coding Style
387
+ It's a pretty long topic, which is difficult to summarize in a single paragraph.
388
+ As a rule of thumbs, try to imitate the coding style of
389
+ similar lines of codes around your contribution.
390
+ The following is a non-exhaustive list of rules employed in zstd code base:
391
+
392
+ ### C90
393
+ This code base is following strict C90 standard,
394
+ with 2 extensions : 64-bit `long long` types, and variadic macros.
395
+ This rule is applied strictly to code within `lib/` and `programs/`.
396
+ Sub-project in `contrib/` are allowed to use other conventions.
397
+
398
+ ### C++ direct compatibility : symbol mangling
399
+ All public symbol declarations must be wrapped in `extern “C” { … }`,
400
+ so that this project can be compiled as C++98 code,
401
+ and linked into C++ applications.
402
+
403
+ ### Minimal Frugal
404
+ This design requirement is fundamental to preserve the portability of the code base.
405
+ #### Dependencies
406
+ - Reduce dependencies to the minimum possible level.
407
+ Any dependency should be considered “bad” by default,
408
+ and only tolerated because it provides a service in a better way than can be achieved locally.
409
+ The only external dependencies this repository tolerates are
410
+ standard C libraries, and in rare cases, system level headers.
411
+ - Within `lib/`, this policy is even more drastic.
412
+ The only external dependencies allowed are `<assert.h>`, `<stdlib.h>`, `<string.h>`,
413
+ and even then, not directly.
414
+ In particular, no function shall ever allocate on heap directly,
415
+ and must use instead `ZSTD_malloc()` and equivalent.
416
+ Other accepted non-symbol headers are `<stddef.h>` and `<limits.h>`.
417
+ - Within the project, there is a strict hierarchy of dependencies that must be respected.
418
+ `programs/` is allowed to depend on `lib/`, but only its public API.
419
+ Within `lib/`, `lib/common` doesn't depend on any other directory.
420
+ `lib/compress` and `lib/decompress` shall not depend on each other.
421
+ `lib/dictBuilder` can depend on `lib/common` and `lib/compress`, but not `lib/decompress`.
422
+ #### Resources
423
+ - Functions in `lib/` must use very little stack space,
424
+ several dozens of bytes max.
425
+ Everything larger must use the heap allocator,
426
+ or require a scratch buffer to be emplaced manually.
427
+
428
+ ### Naming
429
+ * All public symbols are prefixed with `ZSTD_`
430
+ + private symbols, with a scope limited to their own unit, are free of this restriction.
431
+ However, since `libzstd` source code can be amalgamated,
432
+ each symbol name must attempt to be (and remain) unique.
433
+ Avoid too generic names that could become ground for future collisions.
434
+ This generally implies usage of some form of prefix.
435
+ * For symbols (functions and variables), naming convention is `PREFIX_camelCase`.
436
+ + In some advanced cases, one can also find :
437
+ - `PREFIX_prefix2_camelCase`
438
+ - `PREFIX_camelCase_extendedQualifier`
439
+ * Multi-words names generally consist of an action followed by object:
440
+ - for example : `ZSTD_createCCtx()`
441
+ * Prefer positive actions
442
+ - `goBackward` rather than `notGoForward`
443
+ * Type names (`struct`, etc.) follow similar convention,
444
+ except that they are allowed and even invited to start by an Uppercase letter.
445
+ Example : `ZSTD_CCtx`, `ZSTD_CDict`
446
+ * Macro names are all Capital letters.
447
+ The same composition rules (`PREFIX_NAME_QUALIFIER`) apply.
448
+ * File names are all lowercase letters.
449
+ The convention is `snake_case`.
450
+ File names **must** be unique across the entire code base,
451
+ even when they stand in clearly separated directories.
452
+
453
+ ### Qualifiers
454
+ * This code base is `const` friendly, if not `const` fanatical.
455
+ Any variable that can be `const` (aka. read-only) **must** be `const`.
456
+ Any pointer which content will not be modified must be `const`.
457
+ This property is then controlled at compiler level.
458
+ `const` variables are an important signal to readers that this variable isn't modified.
459
+ Conversely, non-const variables are a signal to readers to watch out for modifications later on in the function.
460
+ * If a function must be inlined, mention it explicitly,
461
+ using project's own portable macros, such as `FORCE_INLINE_ATTR`,
462
+ defined in `lib/common/compiler.h`.
463
+
464
+ ### Debugging
465
+ * **Assertions** are welcome, and should be used very liberally,
466
+ to control any condition the code expects for its correct execution.
467
+ These assertion checks will be run in debug builds, and disabled in production.
468
+ * For traces, this project provides its own debug macros,
469
+ in particular `DEBUGLOG(level, ...)`, defined in `lib/common/debug.h`.
470
+
471
+ ### Code documentation
472
+ * Avoid code documentation that merely repeats what the code is already stating.
473
+ Whenever applicable, prefer employing the code as the primary way to convey explanations.
474
+ Example 1 : `int nbTokens = n;` instead of `int i = n; /* i is a nb of tokens *./`.
475
+ Example 2 : `assert(size > 0);` instead of `/* here, size should be positive */`.
476
+ * At declaration level, the documentation explains how to use the function or variable
477
+ and when applicable why it's needed, of the scenarios where it can be useful.
478
+ * At implementation level, the documentation explains the general outline of the algorithm employed,
479
+ and when applicable why this specific choice was preferred.
480
+
481
+ ### General layout
402
482
  * 4 spaces for indentation rather than tabs
483
+ * Code documentation shall directly precede function declaration or implementation
484
+ * Function implementations and its code documentation should be preceded and followed by an empty line
485
+
403
486
 
404
487
  ## License
405
488
  By contributing to Zstandard, you agree that your contributions will be licensed
data/contrib/zstd/LICENSE CHANGED
@@ -2,7 +2,7 @@ BSD License
2
2
 
3
3
  For Zstandard software
4
4
 
5
- Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
5
+ Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
6
6
 
7
7
  Redistribution and use in source and binary forms, with or without modification,
8
8
  are permitted provided that the following conditions are met:
@@ -14,9 +14,9 @@ are permitted provided that the following conditions are met:
14
14
  this list of conditions and the following disclaimer in the documentation
15
15
  and/or other materials provided with the distribution.
16
16
 
17
- * Neither the name Facebook nor the names of its contributors may be used to
18
- endorse or promote products derived from this software without specific
19
- prior written permission.
17
+ * Neither the name Facebook, nor Meta, nor the names of its contributors may
18
+ be used to endorse or promote products derived from this software without
19
+ specific prior written permission.
20
20
 
21
21
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22
22
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED