Update lib/compress to not require common/*.h

This commit is contained in:
Nick Mathewson 2018-06-28 13:19:58 -04:00
parent 3d1e99d01b
commit 4dda026f0d
7 changed files with 28 additions and 15 deletions

View File

@ -1,7 +1,11 @@
orconfig.h orconfig.h
lib/arch/*.h
lib/cc/*.h lib/cc/*.h
lib/compress/*.h lib/compress/*.h
lib/ctime/*.h
lib/intmath/*.h
lib/log/*.h lib/log/*.h
lib/malloc/*.h
# XXX I'd like to remove this. lib/string/*.h
common/*.h lib/testsupport/*.h
lib/thread/*.h

View File

@ -19,13 +19,18 @@
#include <netinet/in.h> #include <netinet/in.h>
#endif #endif
#include "common/util.h"
#include "lib/log/torlog.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.h"
#include "lib/compress/compress_lzma.h" #include "lib/compress/compress_lzma.h"
#include "lib/compress/compress_none.h" #include "lib/compress/compress_none.h"
#include "lib/compress/compress_zlib.h" #include "lib/compress/compress_zlib.h"
#include "lib/compress/compress_zstd.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. */ /** Total number of bytes allocated for compression state overhead. */
static atomic_counter_t total_compress_allocation; static atomic_counter_t total_compress_allocation;
@ -671,4 +676,3 @@ tor_compress_log_init_warnings(void)
{ {
tor_zstd_warn_if_version_mismatched(); tor_zstd_warn_if_version_mismatched();
} }

View File

@ -11,6 +11,9 @@
#ifndef TOR_COMPRESS_H #ifndef TOR_COMPRESS_H
#define 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 /** Enumeration of what kind of compression to use. Only ZLIB_METHOD and
* GZIP_METHOD is guaranteed to be supported by the compress/uncompress * GZIP_METHOD is guaranteed to be supported by the compress/uncompress
* functions here. Call tor_compress_supports_method() to check if a given * 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); void tor_compress_log_init_warnings(void);
#endif /* !defined(TOR_COMPRESS_H) */ #endif /* !defined(TOR_COMPRESS_H) */

View File

@ -13,10 +13,12 @@
#include "orconfig.h" #include "orconfig.h"
#include "common/util.h"
#include "lib/log/torlog.h"
#include "lib/compress/compress.h" #include "lib/compress/compress.h"
#include "lib/compress/compress_lzma.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 #ifdef HAVE_LZMA
#include <lzma.h> #include <lzma.h>
@ -358,4 +360,3 @@ tor_lzma_init(void)
{ {
atomic_counter_init(&total_lzma_allocation); atomic_counter_init(&total_lzma_allocation);
} }

View File

@ -16,10 +16,12 @@
#include "orconfig.h" #include "orconfig.h"
#include "common/util.h"
#include "lib/log/torlog.h" #include "lib/log/torlog.h"
#include "lib/compress/compress.h" #include "lib/compress/compress.h"
#include "lib/compress/compress_none.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 /** 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 * *<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; return TOR_COMPRESS_BUFFER_FULL;
} }
} }

View File

@ -13,10 +13,11 @@
#include "orconfig.h" #include "orconfig.h"
#include "common/util.h"
#include "lib/log/torlog.h" #include "lib/log/torlog.h"
#include "lib/log/util_bug.h"
#include "lib/compress/compress.h" #include "lib/compress/compress.h"
#include "lib/compress/compress_zlib.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 /* 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 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); atomic_counter_init(&total_zlib_allocation);
} }

View File

@ -13,10 +13,12 @@
#include "orconfig.h" #include "orconfig.h"
#include "common/util.h"
#include "lib/log/torlog.h" #include "lib/log/torlog.h"
#include "lib/log/util_bug.h"
#include "lib/compress/compress.h" #include "lib/compress/compress.h"
#include "lib/compress/compress_zstd.h" #include "lib/compress/compress_zstd.h"
#include "lib/string/printf.h"
#include "lib/thread/threads.h"
#ifdef ENABLE_ZSTD_ADVANCED_APIS #ifdef ENABLE_ZSTD_ADVANCED_APIS
/* This is a lie, but we make sure it doesn't get us in trouble by wrapping /* 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; static_apis_disable_for_testing = disabled;
} }
#endif #endif