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

[tor-commits] [tor/master] Silence -Wbad-function-cast warning (when DEBUG_SMARTLIST is on)



commit 9876575d2c14ced3febca0c1a65808585fe8504d
Author: rl1987 <rl1987@xxxxxxxxxxxxxxxx>
Date:   Sun Jun 3 16:45:09 2018 +0300

    Silence -Wbad-function-cast warning (when DEBUG_SMARTLIST is on)
---
 changes/bug26283    | 4 ++++
 src/or/routerlist.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/changes/bug26283 b/changes/bug26283
new file mode 100644
index 000000000..5ec856af8
--- /dev/null
+++ b/changes/bug26283
@@ -0,0 +1,4 @@
+  o Minor bugfixes (C correctness):
+    - Avoid casting return value of smartlist_len() to double as
+      compiler does not like it when -Wbad-function-cast is on.
+      Fixes bug 26283; bugfix on 0.2.4.10-alpha.
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 7603eb3ec..8788dc019 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -2764,7 +2764,7 @@ frac_nodes_with_descriptors(const smartlist_t *sl,
       if (node_has_any_descriptor(node))
         n_with_descs++;
     });
-    return ((double)n_with_descs) / (double)smartlist_len(sl);
+    return ((double)n_with_descs) / smartlist_len(sl);
   }
 
   present = 0.0;



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