]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Extract error functionality into a new lowest-level library.
authorNick Mathewson <nickm@torproject.org>
Thu, 21 Jun 2018 13:53:08 +0000 (09:53 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 21 Jun 2018 14:47:11 +0000 (10:47 -0400)
.gitignore
Makefile.am
src/common/include.am
src/include.am
src/lib/err/backtrace.c [moved from src/common/backtrace.c with 100% similarity]
src/lib/err/backtrace.h [moved from src/common/backtrace.h with 100% similarity]
src/lib/err/include.am [new file with mode: 0644]
src/lib/err/torerr.c [moved from src/common/torerr.c with 100% similarity]
src/lib/err/torerr.h [moved from src/common/torerr.h with 100% similarity]
src/rust/build.rs

index b3b13694af926ea973a53ada1471da853fc90540..517022399b7c3dacbab5db04bc22d42f40104133 100644 (file)
@@ -166,6 +166,10 @@ uptime-*.json
 /src/ext/keccak-tiny/libkeccak-tiny.a
 /src/ext/keccak-tiny/libkeccak-tiny.lib
 
+# /src/lib
+/src/lib/libtor-err.a
+/src/lib/libtor-err-testing.a
+
 # /src/or/
 /src/or/Makefile
 /src/or/Makefile.in
index 579b9a089c0983547943bed907b7461cdcfde12b..6c60de111c214e58e177bc6ff5300cadc9dc6757 100644 (file)
@@ -40,12 +40,14 @@ endif
 # "Common" libraries used to link tor's utility code.
 TOR_UTIL_LIBS = \
        src/common/libor.a \
+        src/lib/libtor-err.a \
        src/common/libor-ctime.a
 
 # Variants of the above for linking the testing variant of tor (for coverage
 # and tests)
 TOR_UTIL_TESTING_LIBS = \
        src/common/libor-testing.a \
+        src/lib/libtor-err-testing.a \
        src/common/libor-ctime-testing.a
 
 # Internal crypto libraries used in Tor
index 8afec9c054244d27e31af9e67824e7184fa208b7..5337034861d1d1408b77d480e3e447dc51652c9c 100644 (file)
@@ -82,7 +82,6 @@ src_common_libor_ctime_testing_a_CFLAGS = @CFLAGS_CONSTTIME@ $(TEST_CFLAGS)
 LIBOR_A_SRC = \
   src/common/address.c                                 \
   src/common/address_set.c                             \
-  src/common/backtrace.c                               \
   src/common/buffers.c                                 \
   src/common/compat.c                                  \
   src/common/compat_threads.c                          \
@@ -99,7 +98,6 @@ LIBOR_A_SRC = \
   src/common/sandbox.c                                 \
   src/common/storagedir.c                              \
   src/common/token_bucket.c                            \
-  src/common/torerr.c                                  \
   src/common/workqueue.c                               \
   $(libor_extra_source)                                        \
   $(threads_impl_source)                               \
@@ -161,7 +159,6 @@ src_common_libor_event_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
 COMMONHEADERS = \
   src/common/address.h                         \
   src/common/address_set.h                     \
-  src/common/backtrace.h                       \
   src/common/buffers.h                         \
   src/common/buffers_tls.h                     \
   src/common/aes.h                             \
@@ -203,7 +200,6 @@ COMMONHEADERS = \
   src/common/testsupport.h                     \
   src/common/timers.h                          \
   src/common/token_bucket.h                    \
-  src/common/torerr.h                          \
   src/common/torint.h                          \
   src/common/torlog.h                          \
   src/common/tortls.h                          \
index 90ecf90d45509205ce7b93aa9acb0254b58ce072..424481485fab4f9811207ee005658eecf06074c3 100644 (file)
@@ -1,6 +1,7 @@
 include src/ext/include.am
-include src/trunnel/include.am
+include src/lib/err/include.am
 include src/common/include.am
+include src/trunnel/include.am
 include src/or/include.am
 include src/rust/include.am
 include src/test/include.am
diff --git a/src/lib/err/include.am b/src/lib/err/include.am
new file mode 100644 (file)
index 0000000..257ba30
--- /dev/null
@@ -0,0 +1,17 @@
+
+noinst_LIBRARIES += src/lib/libtor-err.a
+
+if UNITTESTS_ENABLED
+noinst_LIBRARIES += src/lib/libtor-err-testing.a
+endif
+
+src_lib_libtor_err_a_SOURCES =                 \
+       src/lib/err/backtrace.c                         \
+       src/lib/err/torerr.c
+
+src_lib_libtor_err_testing_a_SOURCES = \
+       $(src_lib_libtor_err_a_SOURCES)
+
+noinst_HEADERS +=                                      \
+       src/lib/err/backtrace.h                         \
+       src/lib/err/torerr.h
similarity index 100%
rename from src/common/torerr.c
rename to src/lib/err/torerr.c
similarity index 100%
rename from src/common/torerr.h
rename to src/lib/err/torerr.h
index b943aa55355c241135d8dcce12ddbe24b97c5eb4..32000b12f56d1e5bd018c08f6a9862660a226c25 100644 (file)
@@ -138,9 +138,9 @@ pub fn main() {
             cfg.from_cflags("TOR_LDFLAGS_openssl");
             cfg.from_cflags("TOR_LDFLAGS_libevent");
 
+            cfg.link_relpath("src/lib");
             cfg.link_relpath("src/common");
             cfg.link_relpath("src/ext/keccak-tiny");
-            cfg.link_relpath("src/ext/keccak-tiny");
             cfg.link_relpath("src/ext/ed25519/ref10");
             cfg.link_relpath("src/ext/ed25519/donna");
             cfg.link_relpath("src/trunnel");
@@ -152,6 +152,7 @@ pub fn main() {
             cfg.component("or-crypto-testing");
             cfg.component("or-ctime-testing");
             cfg.component("or-testing");
+            cfg.component("tor-err-testing");
             cfg.component("or-event-testing");
             cfg.component("or-ctime-testing");
             cfg.component("curve25519_donna");