aboutsummaryrefslogtreecommitdiff
path: root/src/or/geoip.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-07-16 13:14:44 -0400
committerNick Mathewson <nickm@torproject.org>2013-08-15 12:03:34 -0400
commit656842441039399aca0dee95b7c51be7a3749ce0 (patch)
tree0c1d6369cdbe371bdefe0f9f8b7128e33fdf1f44 /src/or/geoip.c
parent6ad535e6dca8e9e284a0fa3384679756dca34a87 (diff)
downloadtor-656842441039399aca0dee95b7c51be7a3749ce0.tar
tor-656842441039399aca0dee95b7c51be7a3749ce0.tar.gz
Use only uintptr_t for the value of transport_count
Diffstat (limited to 'src/or/geoip.c')
-rw-r--r--src/or/geoip.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/or/geoip.c b/src/or/geoip.c
index 866f6a79e..b4f54d4eb 100644
--- a/src/or/geoip.c
+++ b/src/or/geoip.c
@@ -810,8 +810,6 @@ geoip_get_transport_history(void)
unsigned granularity = IP_GRANULARITY;
/** String hash table <name of transport> -> <number of users>. */
strmap_t *transport_counts = strmap_new();
- void *ptr;
- intptr_t val;
/** Smartlist that contains copies of the names of the transports
that have been used. */
@@ -847,13 +845,15 @@ geoip_get_transport_history(void)
/* Loop through all clients. */
HT_FOREACH(ent, clientmap, &client_history) {
+ uintptr_t val;
+ void *ptr;
transport_name = (*ent)->transport_name;
if (!transport_name)
transport_name = no_transport_str;
/* Increase the count for this transport name. */
ptr = strmap_get(transport_counts, transport_name);
- val = (intptr_t)ptr;
+ val = (uintptr_t)ptr;
val++;
ptr = (void*)val;
strmap_set(transport_counts, transport_name, ptr);
@@ -875,15 +875,16 @@ geoip_get_transport_history(void)
/* Loop through all seen transports. */
SMARTLIST_FOREACH_BEGIN(transports_used, const char *, transport_name) {
void *transport_count_ptr = strmap_get(transport_counts, transport_name);
- unsigned int transport_count = (intptr_t) transport_count_ptr;
+ uintptr_t transport_count = (uintptr_t) transport_count_ptr;
- log_debug(LD_GENERAL, "We got %u clients with transport '%s'.",
- transport_count, transport_name);
+ log_debug(LD_GENERAL, "We got "U64_FORMAT" clients with transport '%s'.",
+ U64_PRINTF_ARG((uint64_t)transport_count), transport_name);
- smartlist_add_asprintf(string_chunks, "%s=%u",
+ smartlist_add_asprintf(string_chunks, "%s="U64_FORMAT,
transport_name,
- round_to_next_multiple_of(transport_count,
- granularity));
+ U64_PRINTF_ARG(round_uint64_to_next_multiple_of(
+ (uint64_t)transport_count,
+ granularity)));
} SMARTLIST_FOREACH_END(transport_name);
the_string = smartlist_join_strings(string_chunks, ",", 0, NULL);