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

[or-cvs] r15102: Pointers do not make good ints. (in tor/trunk: . src/or)



Author: nickm
Date: 2008-06-10 15:06:48 -0400 (Tue, 10 Jun 2008)
New Revision: 15102

Modified:
   tor/trunk/
   tor/trunk/src/or/geoip.c
Log:
 r16133@tombo:  nickm | 2008-06-10 15:06:43 -0400
 Pointers do not make good ints.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r16133] on 49666b30-7950-49c5-bedf-9dc8f3168102

Modified: tor/trunk/src/or/geoip.c
===================================================================
--- tor/trunk/src/or/geoip.c	2008-06-10 19:06:46 UTC (rev 15101)
+++ tor/trunk/src/or/geoip.c	2008-06-10 19:06:48 UTC (rev 15102)
@@ -289,6 +289,8 @@
 
   /* DOCDOC */
   while (current_request_period_starts + REQUEST_HIST_PERIOD >= now) {
+    if (!geoip_countries)
+      geoip_countries = smartlist_create();
     SMARTLIST_FOREACH(geoip_countries, geoip_country_t *, c, {
         memmove(&c->n_v2_ns_requests[0], &c->n_v2_ns_requests[1],
                 sizeof(uint32_t)*(REQUEST_HIST_LEN-1));
@@ -509,7 +511,7 @@
       char buf[32];
       for (i=0; i < REQUEST_HIST_LEN; ++i)
         tot += n[i];
-      tor_snprintf(buf, sizeof(buf), "%s=%ld", c->countrycode, (long)n);
+      tor_snprintf(buf, sizeof(buf), "%s=%ld", c->countrycode, (long)tot);
       smartlist_add(entries, tor_strdup(buf));
   });
   smartlist_sort_strings(entries);