fix const char * vs char * issue

plus unshadow some variables


svn:r2460
This commit is contained in:
Roger Dingledine 2004-10-13 04:44:37 +00:00
parent 9dc72de41f
commit a1041154eb

View File

@ -466,6 +466,8 @@ list_running_servers(char **nicknames_out)
int i; int i;
int length; int length;
smartlist_t *nicknames_up, *nicknames_down; smartlist_t *nicknames_up, *nicknames_down;
char *name;
const char *s;
*nicknames_out = NULL; *nicknames_out = NULL;
nicknames_up = smartlist_create(); nicknames_up = smartlist_create();
@ -474,13 +476,12 @@ list_running_servers(char **nicknames_out)
get_connection_array(&connection_array, &n_conns); get_connection_array(&connection_array, &n_conns);
for (i = 0; i<n_conns; ++i) { for (i = 0; i<n_conns; ++i) {
char *name, *cp;
conn = connection_array[i]; conn = connection_array[i];
if (conn->type != CONN_TYPE_OR || !conn->nickname) if (conn->type != CONN_TYPE_OR || !conn->nickname)
continue; /* only list ORs. */ continue; /* only list ORs. */
cp = dirserv_get_nickname_by_digest(conn->identity_digest); s = dirserv_get_nickname_by_digest(conn->identity_digest);
if (cp) { if (s) {
name = tor_strdup(cp); name = tor_strdup(s);
} else { } else {
name = tor_malloc(HEX_DIGEST_LEN+2); name = tor_malloc(HEX_DIGEST_LEN+2);
*name = '$'; *name = '$';