[tor-commits] [tor/master] Use fewer TO_ORIGIN_CIRCUIT casts in getinfo_helper_events
nickm at torproject.org
nickm at torproject.org
Thu Dec 22 15:54:50 UTC 2011
commit 8d5200c6b527443040520786397d1ffd81b42e23
Author: Robert Ransom <rransom.8774 at gmail.com>
Date: Thu Jun 23 15:02:16 2011 -0700
Use fewer TO_ORIGIN_CIRCUIT casts in getinfo_helper_events
---
src/or/control.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/or/control.c b/src/or/control.c
index 620b2f5..2957309 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1846,29 +1846,30 @@ getinfo_helper_events(control_connection_t *control_conn,
{
(void) control_conn;
if (!strcmp(question, "circuit-status")) {
- circuit_t *circ;
+ circuit_t *circ_;
smartlist_t *status = smartlist_create();
- for (circ = _circuit_get_global_list(); circ; circ = circ->next) {
+ for (circ_ = _circuit_get_global_list(); circ_; circ_ = circ_->next) {
+ origin_circuit_t *circ;
char *s, *circdesc;
size_t slen;
const char *state;
- if (! CIRCUIT_IS_ORIGIN(circ) || circ->marked_for_close)
+ if (! CIRCUIT_IS_ORIGIN(circ_) || circ_->marked_for_close)
continue;
+ circ = TO_ORIGIN_CIRCUIT(circ_);
- if (circ->state == CIRCUIT_STATE_OPEN)
+ if (circ->_base.state == CIRCUIT_STATE_OPEN)
state = "BUILT";
- else if (TO_ORIGIN_CIRCUIT(circ)->cpath)
+ else if (circ->cpath)
state = "EXTENDED";
else
state = "LAUNCHED";
- circdesc = circuit_describe_status_for_controller(
- TO_ORIGIN_CIRCUIT(circ));
+ circdesc = circuit_describe_status_for_controller(circ);
slen = strlen(circdesc)+strlen(state)+30;
s = tor_malloc(slen+1);
tor_snprintf(s, slen, "%lu %s%s%s",
- (unsigned long)TO_ORIGIN_CIRCUIT(circ)->global_identifier,
+ (unsigned long)circ->global_identifier,
state, *circdesc ? " " : "", circdesc);
smartlist_add(status, s);
tor_free(circdesc);
More information about the tor-commits
mailing list