[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] remove node_describe_by_id() function



commit 0fbe7f31883787df9c6fe91a3869e5f3f6a2befe
Author: Qingping Hou <dave2008713@xxxxxxxxx>
Date:   Tue Feb 4 19:40:55 2014 -0500

    remove node_describe_by_id() function
    
    This function is not used anymore
---
 src/or/router.c        |   23 -----------------------
 src/or/router.h        |    1 -
 src/test/include.am    |    1 -
 src/test/test.c        |    2 --
 src/test/test_router.c |   37 -------------------------------------
 5 files changed, 64 deletions(-)

diff --git a/src/or/router.c b/src/or/router.c
index 8f56edd..fd0df52 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -2916,29 +2916,6 @@ node_describe(const node_t *node)
   return node_get_description(buf, node);
 }
 
-/** Return a human-readable description of the node whose identity is
- * <b>identity_digest</b>. If node_get_by_id() returns NULL, base 16 encoding
- * of <b>identity_digest</b> is returned instead.
- *
- * This function is not thread-safe.  Each call to this function invalidates
- * previous values returned by this function.
- */
-const char *
-node_describe_by_id(const char *identity_digest)
-{
-  static char buf[NODE_DESC_BUF_LEN];
-  const node_t *node = NULL;
-
-  node = node_get_by_id(identity_digest);
-  if (!node) {
-    buf[0] = '$';
-    base16_encode(buf+1, HEX_DIGEST_LEN+1, identity_digest, DIGEST_LEN);
-    return buf;
-  } else {
-    return node_get_description(buf, node);
-  }
-}
-
 /** Return a human-readable description of the routerstatus_t <b>rs</b>.
  *
  * This function is not thread-safe.  Each call to this function invalidates
diff --git a/src/or/router.h b/src/or/router.h
index a6271c3..1ee0577 100644
--- a/src/or/router.h
+++ b/src/or/router.h
@@ -132,7 +132,6 @@ const char *routerstatus_get_description(char *buf, const routerstatus_t *rs);
 const char *extend_info_get_description(char *buf, const extend_info_t *ei);
 const char *router_describe(const routerinfo_t *ri);
 const char *node_describe(const node_t *node);
-const char *node_describe_by_id(const char *id_digest);
 const char *routerstatus_describe(const routerstatus_t *ri);
 const char *extend_info_describe(const extend_info_t *ei);
 
diff --git a/src/test/include.am b/src/test/include.am
index 9f6c3e0..aa6a872 100644
--- a/src/test/include.am
+++ b/src/test/include.am
@@ -39,7 +39,6 @@ src_test_test_SOURCES = \
 	src/test/test_util.c \
 	src/test/test_config.c \
 	src/test/test_hs.c \
-	src/test/test_router.c \
 	src/ext/tinytest.c
 
 src_test_test_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
diff --git a/src/test/test.c b/src/test/test.c
index 8b2a5ad..3f8e9c6 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -1626,7 +1626,6 @@ extern struct testcase_t controller_event_tests[];
 extern struct testcase_t logging_tests[];
 extern struct testcase_t backtrace_tests[];
 extern struct testcase_t hs_tests[];
-extern struct testcase_t router_tests[];
 
 static struct testgroup_t testgroups[] = {
   { "", test_array },
@@ -1651,7 +1650,6 @@ static struct testgroup_t testgroups[] = {
   { "extorport/", extorport_tests },
   { "control/", controller_event_tests },
   { "hs/", hs_tests },
-  { "router/", router_tests },
   END_OF_GROUPS
 };
 
diff --git a/src/test/test_router.c b/src/test/test_router.c
deleted file mode 100644
index 5e81656..0000000
--- a/src/test/test_router.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (c) 2007-2013, The Tor Project, Inc. */
-/* See LICENSE for licensing information */
-
-/**
- * \file test_router.c
- * \brief Unit tests for router related functions.
- **/
-
-#include "or.h"
-#include "nodelist.h"
-#include "router.h"
-#include "test.h"
-
-/** Tese the case when node_get_by_id() returns NULL, node_describe_by_id
- * should return the base 16 encoding of the id.
- */
-static void
-test_node_describe_by_id_null_node(void *arg)
-{
-  const char ID[] = "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
-                    "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA";
-  (void) arg;
-
-  /* make sure node_get_by_id returns NULL */
-  test_assert(!node_get_by_id(ID));
-  test_streq(node_describe_by_id(ID),
-              "$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
- done:
-  return;
-}
-
-struct testcase_t router_tests[] = {
-  { "node_get_by_id_null_node", test_node_describe_by_id_null_node, TT_FORK,
-    NULL, NULL },
-  END_OF_TESTCASES
-};
-



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits