diff options
author | Roger Dingledine <arma@torproject.org> | 2009-01-28 07:16:22 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2009-01-28 07:16:22 +0000 |
commit | 9fdae765e30695fdb7018c4b30932e3e4e28d144 (patch) | |
tree | 7bec6cb42d326233d1c99dda2d935e84f169f1bf /src/or/control.c | |
parent | edff6063172ad4fb6a835b2c218856aa93efe8da (diff) | |
download | tor-9fdae765e30695fdb7018c4b30932e3e4e28d144.tar.gz tor-9fdae765e30695fdb7018c4b30932e3e4e28d144.zip |
clean up r18287
svn:r18288
Diffstat (limited to 'src/or/control.c')
-rw-r--r-- | src/or/control.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/or/control.c b/src/or/control.c index 9f80d38cf6..f435251751 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -1839,23 +1839,20 @@ getinfo_helper_events(control_connection_t *control_conn, } } else if (!strcmp(question, "status/clients-seen")) { char geoip_start[ISO_TIME_LEN+1]; - char *geoip_summary; - smartlist_t *sl; + size_t answer_len; + char *geoip_summary = extrainfo_get_client_geoip_summary(time(NULL)); - geoip_summary = extrainfo_get_client_geoip_summary(time(NULL)); if (!geoip_summary) return -1; - format_iso_time(geoip_start, geoip_get_history_start()); - - sl = smartlist_create(); - smartlist_add(sl, (char *)"TimeStarted=\""); - smartlist_add(sl, geoip_start); - smartlist_add(sl, (char *)"\" CountrySummary="); - smartlist_add(sl, geoip_summary); - *answer = smartlist_join_strings(sl, "", 0, 0); + answer_len = strlen("TimeStarted=\"\" CountrySummary=") + + ISO_TIME_LEN + strlen(geoip_summary) + 1; + *answer = tor_malloc(answer_len); + format_iso_time(geoip_start, geoip_get_history_start()); + tor_snprintf(*answer, answer_len, + "TimeStarted=\"%s\" CountrySummary=%s", + geoip_start, geoip_summary); tor_free(geoip_summary); - smartlist_free(sl); } else { return 0; } |