aboutsummaryrefslogtreecommitdiff
path: root/src/or/rephist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-01-11 14:02:59 -0500
committerNick Mathewson <nickm@torproject.org>2012-01-16 15:03:13 -0500
commitcc02823d7f6acbc3fa8ea87e5646921100796f10 (patch)
tree45d4ba4a4cc9ef73c076f08934f68d9690b9044c /src/or/rephist.c
parentedcc9981d8b8894d2ef4e0d617a20d7d99547817 (diff)
downloadtor-cc02823d7f6acbc3fa8ea87e5646921100796f10.tar
tor-cc02823d7f6acbc3fa8ea87e5646921100796f10.tar.gz
Convert instances of tor_snprintf+strdup into tor_asprintf
These were found by looking for tor_snprintf() instances that were followed closely by tor_strdup(), though I probably converted some other snprintfs as well.
Diffstat (limited to 'src/or/rephist.c')
-rw-r--r--src/or/rephist.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c
index b7bd2387f..4129fe2bb 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -941,7 +941,6 @@ rep_hist_get_router_stability_doc(time_t now)
DIGESTMAP_FOREACH(history_map, id, or_history_t *, hist) {
const node_t *node;
char dbuf[BASE64_DIGEST_LEN+1];
- char header_buf[512];
char *info;
digest_to_base64(dbuf, id);
node = node_get_by_id(id);
@@ -954,7 +953,7 @@ rep_hist_get_router_stability_doc(time_t now)
format_iso_time(tbuf, published);
else
strlcpy(tbuf, "???", sizeof(tbuf));
- tor_snprintf(header_buf, sizeof(header_buf),
+ smartlist_add_asprintf(chunks,
"router %s %s %s\n"
"published %s\n"
"relevant-flags %s%s%s\n"
@@ -966,10 +965,9 @@ rep_hist_get_router_stability_doc(time_t now)
node->ri && node->ri->is_hibernating ? "Hibernating " : "",
node_get_declared_uptime(node));
} else {
- tor_snprintf(header_buf, sizeof(header_buf),
+ smartlist_add_asprintf(chunks,
"router %s {no descriptor}\n", dbuf);
}
- smartlist_add(chunks, tor_strdup(header_buf));
info = rep_hist_format_router_status(hist, now);
if (info)
smartlist_add(chunks, info);