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

[tor-dev] [Patch] or/networkstatus.c



Hi list.

In or/networkstatus.c there is a "#if 0" block inside the macro "SMARTLIST_FOREACH_JOIN". Not all compilers handle such contructs.
In the prosess of making solution/projects file for "MS Visual C++ 2010 Express",
I hit this problem (cl Version 16.00.30319.01). Can you please accept the following patch:

diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 2586ce6..d8d6680 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -2001,19 +2001,25 @@ routers_update_status_from_consensus_networkstatus(smartlist_t *routers,

  routers_sort_by_identity(routers);

+  /* Since not all compilers handles '#' inside macros, we use a helper-macro. */
+#if 0
+  #define CHECK_ROUTER_PURPOSE() do { \
+    /* We have no routerstatus for this router. Clear flags and skip it. */ \
+    if (!authdir) { \
+      if (router->purpose == ROUTER_PURPOSE_GENERAL) \
+        router_clear_status_flags(router); \
+    } \
+   } while (0)
+#else
+  #define CHECK_ROUTER_PURPOSE()
+#endif
+
  SMARTLIST_FOREACH_JOIN(ns->routerstatus_list, routerstatus_t *, rs,
                         routers, routerinfo_t *, router,
                         tor_memcmp(rs->identity_digest,
                               router->cache_info.identity_digest, DIGEST_LEN),
+                        {  CHECK_ROUTER_PURPOSE(); })
  {
-#if 0
-    /* We have no routerstatus for this router. Clear flags and skip it. */
-    if (!authdir) {
-      if (router->purpose == ROUTER_PURPOSE_GENERAL)
-        router_clear_status_flags(router);
-    }
-#endif
-  }) {
    /* We have a routerstatus for this router. */
    const char *digest = router->cache_info.identity_digest;

------------------------

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