Переглянути джерело

Include the *_sha1.i files in their own *_codedigest.c files.

This way we do not need to rebuild util.c and/or config.c whenever
any unrelated source file in src/common or src/or has changed.
Nick Mathewson 15 роки тому
батько
коміт
fdbdb4dc15

+ 2 - 2
src/common/Makefile.am

@@ -12,7 +12,7 @@ libor_extra_source=
 endif
 
 libor_a_SOURCES = address.c log.c util.c compat.c container.c mempool.c \
-	memarea.c $(libor_extra_source)
+	memarea.c util_codedigest.c $(libor_extra_source)
 libor_crypto_a_SOURCES = crypto.c aes.c tortls.c torgzip.c
 
 noinst_HEADERS = address.h log.h crypto.h test.h util.h compat.h aes.h torint.h tortls.h strlcpy.c strlcat.c torgzip.h container.h ht.h mempool.h memarea.h ciphers.inc
@@ -27,4 +27,4 @@ common_sha1.i: $(libor_SOURCES) $(libor_crypto_a_SOURCES) $(noinst_HEADERS)
 	  touch common_sha1.i; \
 	fi
 
-util.o: common_sha1.i
+util_codedigest.o: common_sha1.i

+ 0 - 8
src/common/util.c

@@ -2562,11 +2562,3 @@ write_pidfile(char *filename)
   }
 }
 
-const char *
-libor_get_digests(void)
-{
-  return ""
-#include "common_sha1.i"
-    ;
-}
-

+ 11 - 0
src/common/util_codedigest.c

@@ -0,0 +1,11 @@
+
+#include "util.h"
+
+const char *
+libor_get_digests(void)
+{
+  return ""
+#include "common_sha1.i"
+    ;
+}
+

+ 3 - 3
src/or/Makefile.am

@@ -20,7 +20,7 @@ tor_SOURCES = buffers.c circuitbuild.c circuitlist.c \
 	networkstatus.c onion.c policies.c \
 	reasons.c relay.c rendcommon.c rendclient.c rendmid.c \
 	rendservice.c rephist.c router.c routerlist.c routerparse.c \
-	eventdns.c \
+	eventdns.c config_codedigest.c \
 	tor_main.c
 
 AM_CPPFLAGS = -DSHARE_DATADIR="\"$(datadir)\"" \
@@ -42,7 +42,7 @@ test_SOURCES = buffers.c circuitbuild.c circuitlist.c \
 	networkstatus.c onion.c policies.c \
 	reasons.c relay.c rendcommon.c rendclient.c rendmid.c \
 	rendservice.c rephist.c router.c routerlist.c routerparse.c \
-	eventdns.c \
+	eventdns.c config_codedigest.c \
 	test_data.c test.c
 
 test_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \
@@ -52,7 +52,7 @@ test_LDADD = ../common/libor.a ../common/libor-crypto.a \
 
 noinst_HEADERS = or.h eventdns.h eventdns_tor.h micro-revision.i
 
-config.o: or_sha1.i
+config_codedigest.o: or_sha1.i
 
 tor_main.o: micro-revision.i
 

+ 1 - 3
src/or/config.c

@@ -3930,9 +3930,7 @@ options_init_from_torrc(int argc, char **argv)
   if (argc > 1 && (!strcmp(argv[1],"--digests"))) {
     printf("Tor version %s.\n",get_version());
     printf("%s", libor_get_digests());
-    printf("%s", ""
-#include "or_sha1.i"
-           );
+    printf("%s", tor_get_digests());
     exit(0);
   }
 

+ 10 - 0
src/or/config_codedigest.c

@@ -0,0 +1,10 @@
+
+const char *tor_get_digests(void);
+
+const char *
+tor_get_digests(void)
+{
+  return ""
+#include "or_sha1.i"
+    ;
+}

+ 2 - 0
src/or/or.h

@@ -2911,6 +2911,8 @@ int options_need_geoip_info(or_options_t *options, const char **reason_out);
 int getinfo_helper_config(control_connection_t *conn,
                           const char *question, char **answer);
 
+const char *tor_get_digests(void);
+
 #ifdef CONFIG_PRIVATE
 /* Used only by config.c and test.c */
 or_options_t *options_new(void);