commit 4dda026f0da05dfccf4fb8a13492b81af9324a39 Author: Nick Mathewson nickm@torproject.org Date: Thu Jun 28 13:19:58 2018 -0400
Update lib/compress to not require common/*.h --- src/lib/compress/.may_include | 10 +++++++--- src/lib/compress/compress.c | 8 ++++++-- src/lib/compress/compress.h | 4 +++- src/lib/compress/compress_lzma.c | 7 ++++--- src/lib/compress/compress_none.c | 5 +++-- src/lib/compress/compress_zlib.c | 4 ++-- src/lib/compress/compress_zstd.c | 5 +++-- 7 files changed, 28 insertions(+), 15 deletions(-)
diff --git a/src/lib/compress/.may_include b/src/lib/compress/.may_include index 3f69dd133..036177469 100644 --- a/src/lib/compress/.may_include +++ b/src/lib/compress/.may_include @@ -1,7 +1,11 @@ orconfig.h +lib/arch/*.h lib/cc/*.h lib/compress/*.h +lib/ctime/*.h +lib/intmath/*.h lib/log/*.h - -# XXX I'd like to remove this. -common/*.h +lib/malloc/*.h +lib/string/*.h +lib/testsupport/*.h +lib/thread/*.h diff --git a/src/lib/compress/compress.c b/src/lib/compress/compress.c index 64f10b45c..23a5c0304 100644 --- a/src/lib/compress/compress.c +++ b/src/lib/compress/compress.c @@ -19,13 +19,18 @@ #include <netinet/in.h> #endif
-#include "common/util.h" #include "lib/log/torlog.h" +#include "lib/log/util_bug.h" +#include "lib/arch/bytes.h" +#include "lib/ctime/di_ops.h" #include "lib/compress/compress.h" #include "lib/compress/compress_lzma.h" #include "lib/compress/compress_none.h" #include "lib/compress/compress_zlib.h" #include "lib/compress/compress_zstd.h" +#include "lib/intmath/cmp.h" +#include "lib/malloc/util_malloc.h" +#include "lib/thread/threads.h"
/** Total number of bytes allocated for compression state overhead. */ static atomic_counter_t total_compress_allocation; @@ -671,4 +676,3 @@ tor_compress_log_init_warnings(void) { tor_zstd_warn_if_version_mismatched(); } - diff --git a/src/lib/compress/compress.h b/src/lib/compress/compress.h index 10ad6d86b..f88cf2cb2 100644 --- a/src/lib/compress/compress.h +++ b/src/lib/compress/compress.h @@ -11,6 +11,9 @@ #ifndef TOR_COMPRESS_H #define TOR_COMPRESS_H
+#include <stddef.h> +#include "lib/testsupport/testsupport.h" + /** Enumeration of what kind of compression to use. Only ZLIB_METHOD and * GZIP_METHOD is guaranteed to be supported by the compress/uncompress * functions here. Call tor_compress_supports_method() to check if a given @@ -90,4 +93,3 @@ void tor_compress_init(void); void tor_compress_log_init_warnings(void);
#endif /* !defined(TOR_COMPRESS_H) */ - diff --git a/src/lib/compress/compress_lzma.c b/src/lib/compress/compress_lzma.c index e7f3680b2..3b6f91b84 100644 --- a/src/lib/compress/compress_lzma.c +++ b/src/lib/compress/compress_lzma.c @@ -13,10 +13,12 @@
#include "orconfig.h"
-#include "common/util.h" -#include "lib/log/torlog.h" #include "lib/compress/compress.h" #include "lib/compress/compress_lzma.h" +#include "lib/log/torlog.h" +#include "lib/log/util_bug.h" +#include "lib/malloc/util_malloc.h" +#include "lib/thread/threads.h"
#ifdef HAVE_LZMA #include <lzma.h> @@ -358,4 +360,3 @@ tor_lzma_init(void) { atomic_counter_init(&total_lzma_allocation); } - diff --git a/src/lib/compress/compress_none.c b/src/lib/compress/compress_none.c index 11f99d82e..9574c47a7 100644 --- a/src/lib/compress/compress_none.c +++ b/src/lib/compress/compress_none.c @@ -16,10 +16,12 @@
#include "orconfig.h"
-#include "common/util.h" #include "lib/log/torlog.h" #include "lib/compress/compress.h" #include "lib/compress/compress_none.h" +#include "lib/intmath/cmp.h" + +#include <string.h>
/** Transfer some bytes using the identity transformation. Read up to * *<b>in_len</b> bytes from *<b>in</b>, and write up to *<b>out_len</b> bytes @@ -50,4 +52,3 @@ tor_cnone_compress_process(char **out, size_t *out_len, return TOR_COMPRESS_BUFFER_FULL; } } - diff --git a/src/lib/compress/compress_zlib.c b/src/lib/compress/compress_zlib.c index 7cba1150e..12e6727de 100644 --- a/src/lib/compress/compress_zlib.c +++ b/src/lib/compress/compress_zlib.c @@ -13,10 +13,11 @@
#include "orconfig.h"
-#include "common/util.h" #include "lib/log/torlog.h" +#include "lib/log/util_bug.h" #include "lib/compress/compress.h" #include "lib/compress/compress_zlib.h" +#include "lib/thread/threads.h"
/* zlib 1.2.4 and 1.2.5 do some "clever" things with macros. Instead of saying "(defined(FOO) ? FOO : 0)" they like to say "FOO-0", on the theory @@ -301,4 +302,3 @@ tor_zlib_init(void) { atomic_counter_init(&total_zlib_allocation); } - diff --git a/src/lib/compress/compress_zstd.c b/src/lib/compress/compress_zstd.c index f24c7a5ab..0a553db55 100644 --- a/src/lib/compress/compress_zstd.c +++ b/src/lib/compress/compress_zstd.c @@ -13,10 +13,12 @@
#include "orconfig.h"
-#include "common/util.h" #include "lib/log/torlog.h" +#include "lib/log/util_bug.h" #include "lib/compress/compress.h" #include "lib/compress/compress_zstd.h" +#include "lib/string/printf.h" +#include "lib/thread/threads.h"
#ifdef ENABLE_ZSTD_ADVANCED_APIS /* This is a lie, but we make sure it doesn't get us in trouble by wrapping @@ -533,4 +535,3 @@ tor_zstd_set_static_apis_disabled_for_testing(int disabled) static_apis_disable_for_testing = disabled; } #endif -