You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2022/06/14 10:06:29 UTC
[couchdb-snappy] 38/38: Merge upstream (skunkwerks) and update Snappy to 1.1.8
This is an automated email from the ASF dual-hosted git repository.
ronny pushed a commit to branch update-snappy
in repository https://gitbox.apache.org/repos/asf/couchdb-snappy.git
commit a38f7d9026b5d7a10cb0c6413738bc21612ee4a6
Merge: 6372bb6 ceaceb4
Author: Ronny Berndt <ro...@apache.org>
AuthorDate: Tue Jun 14 11:53:40 2022 +0200
Merge upstream (skunkwerks) and update Snappy to 1.1.8
.gitignore | 38 ++
Makefile | 43 +-
README.md | 33 +-
c_src/snappy/snappy-internal.h | 135 ++++-
c_src/snappy/snappy-stubs-internal.cc | 2 +-
c_src/snappy/snappy-stubs-internal.h | 200 +++++--
c_src/snappy/snappy-stubs-public.h | 34 +-
c_src/snappy/snappy.cc | 1000 ++++++++++++++++++---------------
c_src/snappy/snappy.h | 24 +-
c_src/snappy_nif.cc | 51 +-
enc | Bin 0 -> 26232 bytes
rebar.config | 20 +-
rebar.lock | 1 +
rebar3 | Bin 0 -> 958634 bytes
src/snappy.app.src | 2 +-
src/snappy.erl | 14 +-
test/snappy_tests.erl | 33 ++
17 files changed, 1025 insertions(+), 605 deletions(-)
diff --cc .gitignore
index 61b4fa5,17d172f..d722831
--- a/.gitignore
+++ b/.gitignore
@@@ -7,3 -7,7 +7,41 @@@ pri
*.la
*~
*.swp
+ _build
+ c_src/snappy/*.d
+ c_src/*.d
+ compile_commands.json
++
++### Elixir ###
++/_build
++/cover
++/deps
++/doc
++/.fetch
++erl_crash.dump
++*.ez
++*.beam
++/config/*.secret.exs
++.elixir_ls/
++
++### Elixir Patch ###
++
++### Erlang ###
++.eunit
++*.o
++*.plt
++.concrete/DEV_MODE
++
++# rebar 2.x
++.rebar
++rel/example_project
++ebin/*.beam
++deps
++
++# rebar 3
++.rebar3
++_build/
++_checkouts/
++
++### Erlang Patch ###
++rebar3.crashdump
diff --cc c_src/snappy_nif.cc
index 50e9018,a8d8665..f9d0139
--- a/c_src/snappy_nif.cc
+++ b/c_src/snappy_nif.cc
@@@ -40,11 -44,9 +44,11 @@@ class SnappyNifSink : public snappy::Si
void Append(const char* data, size_t n);
char* GetAppendBuffer(size_t len, char* scratch);
- ErlNifBinary& GetBin();
+ ErlNifBinary& getBin();
private:
+ void EnsureSize(size_t append_length);
+
ErlNifEnv* env;
ErlNifBinary bin;
size_t length;
@@@ -93,21 -103,6 +97,19 @@@ SnappyNifSink::getBin(
return bin;
}
-
+void
+SnappyNifSink::EnsureSize(size_t append_length)
+{
++ size_t sz;
++
+ if((length + append_length) > bin.size) {
- size_t sz = append_length * 4;
- if(sz < 8192) {
- sz = 8192;
- }
++ sz = (append_length * 4) < 8192 ? 8192 : (append_length * 4);
+
+ if(!enif_realloc_binary_compat(env, &bin, bin.size + sz)) {
+ throw std::bad_alloc();
+ }
+ }
+}
static inline ERL_NIF_TERM
make_atom(ErlNifEnv* env, const char* name)