[tor-commits] [tor/main] Remove some needless includes

nickm at torproject.org nickm at torproject.org
Mon Jul 12 20:27:02 UTC 2021


commit 27d6b3ae7a7e1464395de9ed7e89d430d52f9356
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Jul 12 15:53:56 2021 -0400

    Remove some needless includes
---
 src/test/fuzz/fuzz_address.c    | 79 +++++++++--------------------------------
 src/test/fuzz/fuzz_addressPTR.c | 75 +++++++++-----------------------------
 2 files changed, 33 insertions(+), 121 deletions(-)

diff --git a/src/test/fuzz/fuzz_address.c b/src/test/fuzz/fuzz_address.c
index 332267fb13..6dccd65e9d 100644
--- a/src/test/fuzz/fuzz_address.c
+++ b/src/test/fuzz/fuzz_address.c
@@ -1,73 +1,26 @@
 #include "lib/net/address.h"
-#include "lib/net/socket.h"
-#include "lib/cc/ctassert.h"
-#include "lib/container/smartlist.h"
-#include "lib/ctime/di_ops.h"
-#include "lib/log/log.h"
-#include "lib/log/escape.h"
 #include "lib/malloc/malloc.h"
-#include "lib/net/inaddr.h"
-#include "lib/string/compat_ctype.h"
-#include "lib/string/compat_string.h"
-#include "lib/string/parse_int.h"
-#include "lib/string/printf.h"
-#include "lib/string/util_string.h"
-
-#include "ext/siphash.h"
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h> /* FreeBSD needs this to know what version it is */
-#endif
-#ifdef HAVE_SYS_UN_H
-#include <sys/un.h>
-#endif
-#ifdef HAVE_IFADDRS_H
-#include <ifaddrs.h>
-#endif
-#ifdef HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h>
-#endif
-#ifdef HAVE_NET_IF_H
-#include <net/if.h>
-#endif
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 
 #include "test/fuzz/fuzzing.h"
 
-int fuzz_init(void){
- return 0;
+int
+fuzz_init(void)
+{
+  return 0;
 }
 
-int fuzz_cleanup(void){
- return 0;
+int
+fuzz_cleanup(void)
+{
+  return 0;
 }
 
-int fuzz_main(const uint8_t *data, size_t sz){
-
- tor_addr_t addr;
- char *fuzzing_data = tor_memdup_nulterm(data, sz);
- tor_addr_parse(&addr, fuzzing_data);
- tor_free(fuzzing_data);
- return 0;
+int
+fuzz_main(const uint8_t *data, size_t sz)
+{
+  tor_addr_t addr;
+  char *fuzzing_data = tor_memdup_nulterm(data, sz);
+  tor_addr_parse(&addr, fuzzing_data);
+  tor_free(fuzzing_data);
+  return 0;
 }
diff --git a/src/test/fuzz/fuzz_addressPTR.c b/src/test/fuzz/fuzz_addressPTR.c
index e60a7dc74b..b503d53666 100644
--- a/src/test/fuzz/fuzz_addressPTR.c
+++ b/src/test/fuzz/fuzz_addressPTR.c
@@ -6,68 +6,27 @@
 #include "lib/log/log.h"
 #include "lib/log/escape.h"
 #include "lib/malloc/malloc.h"
-#include "lib/net/inaddr.h"
-#include "lib/string/compat_ctype.h"
-#include "lib/string/compat_string.h"
-#include "lib/string/parse_int.h"
-#include "lib/string/printf.h"
-#include "lib/string/util_string.h"
-
-#include "ext/siphash.h"
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h> /* FreeBSD needs this to know what version it is */
-#endif
-#ifdef HAVE_SYS_UN_H
-#include <sys/un.h>
-#endif
-#ifdef HAVE_IFADDRS_H
-#include <ifaddrs.h>
-#endif
-#ifdef HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h>
-#endif
-#ifdef HAVE_NET_IF_H
-#include <net/if.h>
-#endif
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
+#include "lib/net/address.h"
 #include "test/fuzz/fuzzing.h"
 
-int fuzz_init(void){
- return 0;
+int
+fuzz_init(void)
+{
+  return 0;
 }
 
-int fuzz_cleanup(void){
- return 0;
+int
+fuzz_cleanup(void)
+{
+  return 0;
 }
 
-int fuzz_main(const uint8_t *data, size_t sz){
-
- tor_addr_t addr_result;
- char *fuzzing_data = tor_memdup_nulterm(data, sz);
- tor_addr_parse_PTR_name(&addr_result, fuzzing_data, AF_UNSPEC, 1);
- tor_free(fuzzing_data);
- return 0;
+int
+fuzz_main(const uint8_t *data, size_t sz)
+{
+  tor_addr_t addr_result;
+  char *fuzzing_data = tor_memdup_nulterm(data, sz);
+  tor_addr_parse_PTR_name(&addr_result, fuzzing_data, AF_UNSPEC, 1);
+  tor_free(fuzzing_data);
+  return 0;
 }



More information about the tor-commits mailing list