commit 2d20cbf837263898ce45c1e0a0f11b9e1126eeba Author: Nick Mathewson nickm@torproject.org Date: Thu Jun 21 11:51:49 2018 -0400
Extract compression functions into a new library. --- .gitignore | 2 ++ Makefile.am | 4 ++-- src/common/include.am | 10 ---------- src/include.am | 1 + src/{common => lib/compress}/compress.c | 0 src/{common => lib/compress}/compress.h | 0 src/{common => lib/compress}/compress_lzma.c | 0 src/{common => lib/compress}/compress_lzma.h | 0 src/{common => lib/compress}/compress_none.c | 0 src/{common => lib/compress}/compress_none.h | 0 src/{common => lib/compress}/compress_zlib.c | 0 src/{common => lib/compress}/compress_zlib.h | 0 src/{common => lib/compress}/compress_zstd.c | 0 src/{common => lib/compress}/compress_zstd.h | 0 src/lib/compress/include.am | 25 +++++++++++++++++++++++++ 15 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/.gitignore b/.gitignore index 2267f5b4f..14ab9f63c 100644 --- a/.gitignore +++ b/.gitignore @@ -167,6 +167,8 @@ uptime-*.json /src/ext/keccak-tiny/libkeccak-tiny.lib
# /src/lib +/src/lib/libtor-compress.a +/src/lib/libtor-compress-testing.a /src/lib/libtor-ctime.a /src/lib/libtor-ctime-testing.a /src/lib/libtor-err.a diff --git a/Makefile.am b/Makefile.am index 59230ab75..5b229d073 100644 --- a/Makefile.am +++ b/Makefile.am @@ -66,6 +66,7 @@ TOR_CRYPTO_TESTING_LIBS = \ # All static libraries used to link tor. TOR_INTERNAL_LIBS = \ src/or/libtor-app.a \ + src/lib/libtor-compress.a \ $(TOR_CRYPTO_LIBS) \ $(TOR_UTIL_LIBS) \ src/common/libor-event.a \ @@ -76,10 +77,9 @@ TOR_INTERNAL_LIBS = \ # and tests) TOR_INTERNAL_TESTING_LIBS = \ src/or/libtor-app-testing.a \ + src/lib/libtor-compress-testing.a \ $(TOR_CRYPTO_TESTING_LIBS) \ $(TOR_UTIL_TESTING_LIBS) \ - $(LIBKECCAK_TINY) \ - $(LIBDONNA) \ src/common/libor-event-testing.a \ src/trunnel/libor-trunnel-testing.a \ src/trace/libor-trace.a diff --git a/src/common/include.am b/src/common/include.am index fa12888ac..5ed4b3c6d 100644 --- a/src/common/include.am +++ b/src/common/include.am @@ -87,11 +87,6 @@ src/common/src_common_libor_testing_a-log.$(OBJEXT) \ LIBOR_CRYPTO_A_SRC = \ src/common/aes.c \ src/common/buffers_tls.c \ - src/common/compress.c \ - src/common/compress_lzma.c \ - src/common/compress_none.c \ - src/common/compress_zlib.c \ - src/common/compress_zstd.c \ src/common/crypto.c \ src/common/crypto_dh.c \ src/common/crypto_digest.c \ @@ -147,11 +142,6 @@ COMMONHEADERS = \ src/common/compat_openssl.h \ src/common/compat_threads.h \ src/common/compat_time.h \ - src/common/compress.h \ - src/common/compress_lzma.h \ - src/common/compress_none.h \ - src/common/compress_zlib.h \ - src/common/compress_zstd.h \ src/common/confline.h \ src/common/container.h \ src/common/crypto.h \ diff --git a/src/include.am b/src/include.am index 296ac19b1..a7b266aa3 100644 --- a/src/include.am +++ b/src/include.am @@ -1,6 +1,7 @@ include src/ext/include.am include src/lib/err/include.am include src/lib/ctime/include.am +include src/lib/compress/include.am include src/common/include.am include src/trunnel/include.am include src/or/include.am diff --git a/src/common/compress.c b/src/lib/compress/compress.c similarity index 100% rename from src/common/compress.c rename to src/lib/compress/compress.c diff --git a/src/common/compress.h b/src/lib/compress/compress.h similarity index 100% rename from src/common/compress.h rename to src/lib/compress/compress.h diff --git a/src/common/compress_lzma.c b/src/lib/compress/compress_lzma.c similarity index 100% rename from src/common/compress_lzma.c rename to src/lib/compress/compress_lzma.c diff --git a/src/common/compress_lzma.h b/src/lib/compress/compress_lzma.h similarity index 100% rename from src/common/compress_lzma.h rename to src/lib/compress/compress_lzma.h diff --git a/src/common/compress_none.c b/src/lib/compress/compress_none.c similarity index 100% rename from src/common/compress_none.c rename to src/lib/compress/compress_none.c diff --git a/src/common/compress_none.h b/src/lib/compress/compress_none.h similarity index 100% rename from src/common/compress_none.h rename to src/lib/compress/compress_none.h diff --git a/src/common/compress_zlib.c b/src/lib/compress/compress_zlib.c similarity index 100% rename from src/common/compress_zlib.c rename to src/lib/compress/compress_zlib.c diff --git a/src/common/compress_zlib.h b/src/lib/compress/compress_zlib.h similarity index 100% rename from src/common/compress_zlib.h rename to src/lib/compress/compress_zlib.h diff --git a/src/common/compress_zstd.c b/src/lib/compress/compress_zstd.c similarity index 100% rename from src/common/compress_zstd.c rename to src/lib/compress/compress_zstd.c diff --git a/src/common/compress_zstd.h b/src/lib/compress/compress_zstd.h similarity index 100% rename from src/common/compress_zstd.h rename to src/lib/compress/compress_zstd.h diff --git a/src/lib/compress/include.am b/src/lib/compress/include.am new file mode 100644 index 000000000..eb3a89c35 --- /dev/null +++ b/src/lib/compress/include.am @@ -0,0 +1,25 @@ + +noinst_LIBRARIES += src/lib/libtor-compress.a + +if UNITTESTS_ENABLED +noinst_LIBRARIES += src/lib/libtor-compress-testing.a +endif + +src_lib_libtor_compress_a_SOURCES = \ + src/lib/compress/compress.c \ + src/lib/compress/compress_lzma.c \ + src/lib/compress/compress_none.c \ + src/lib/compress/compress_zlib.c \ + src/lib/compress/compress_zstd.c + +src_lib_libtor_compress_testing_a_SOURCES = \ + $(src_lib_libtor_compress_a_SOURCES) +src_lib_libtor_compress_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS) +src_lib_libtor_compress_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS) + +noinst_HEADERS += \ + src/lib/compress/compress.h \ + src/lib/compress/compress_lzma.h \ + src/lib/compress/compress_none.h \ + src/lib/compress/compress_zlib.h \ + src/lib/compress/compress_zstd.h