[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

On Sun, Jul 31, 2011 at 7:10 AM, Gisle Vanem <gvanem@broadpark.no> wrote:
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:
The code is if-0'd out; I say we should just remove it in 0.2.3. (Erinn and I ran into this issue last week making draft nmake files.)

"Nick Mathewson" <nickm@alum.mit.edu> wrote:
On Sun, Jul 31, 2011 at 7:10 AM, Gisle Vanem <gvanem@broadpark.no> wrote:
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:
The code is if-0'd out; I say we should just remove it in 0.2.3.
That would be just fine. --gv
participants (2)
-
Gisle Vanem
-
Nick Mathewson