mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
Three more -Wshadow fixes.
This commit is contained in:
parent
9fe6fea1cc
commit
dffc6910b1
@ -279,21 +279,21 @@ tor_reallocarray_(void *ptr, size_t sz1, size_t sz2 DMALLOC_PARAMS)
|
||||
char *
|
||||
tor_strdup_(const char *s DMALLOC_PARAMS)
|
||||
{
|
||||
char *dup;
|
||||
char *duplicate;
|
||||
tor_assert(s);
|
||||
|
||||
#ifdef USE_DMALLOC
|
||||
dup = dmalloc_strdup(file, line, s, 0);
|
||||
duplicate = dmalloc_strdup(file, line, s, 0);
|
||||
#else
|
||||
dup = strdup(s);
|
||||
duplicate = strdup(s);
|
||||
#endif
|
||||
if (PREDICT_UNLIKELY(dup == NULL)) {
|
||||
if (PREDICT_UNLIKELY(duplicate == NULL)) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_err(LD_MM,"Out of memory on strdup(). Dying.");
|
||||
exit(1);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
return dup;
|
||||
return duplicate;
|
||||
}
|
||||
|
||||
/** Allocate and return a new string containing the first <b>n</b>
|
||||
|
@ -1881,7 +1881,8 @@ choose_good_exit_server(uint8_t purpose,
|
||||
/** Log a warning if the user specified an exit for the circuit that
|
||||
* has been excluded from use by ExcludeNodes or ExcludeExitNodes. */
|
||||
static void
|
||||
warn_if_last_router_excluded(origin_circuit_t *circ, const extend_info_t *exit)
|
||||
warn_if_last_router_excluded(origin_circuit_t *circ,
|
||||
const extend_info_t *exit_ei)
|
||||
{
|
||||
const or_options_t *options = get_options();
|
||||
routerset_t *rs = options->ExcludeNodes;
|
||||
@ -1928,13 +1929,13 @@ warn_if_last_router_excluded(origin_circuit_t *circ, const extend_info_t *exit)
|
||||
break;
|
||||
}
|
||||
|
||||
if (routerset_contains_extendinfo(rs, exit)) {
|
||||
if (routerset_contains_extendinfo(rs, exit_ei)) {
|
||||
/* We should never get here if StrictNodes is set to 1. */
|
||||
if (options->StrictNodes) {
|
||||
log_warn(LD_BUG, "Using %s '%s' which is listed in ExcludeNodes%s, "
|
||||
"even though StrictNodes is set. Please report. "
|
||||
"(Circuit purpose: %s)",
|
||||
description, extend_info_describe(exit),
|
||||
description, extend_info_describe(exit_ei),
|
||||
rs==options->ExcludeNodes?"":" or ExcludeExitNodes",
|
||||
circuit_purpose_to_string(purpose));
|
||||
} else {
|
||||
@ -1943,7 +1944,7 @@ warn_if_last_router_excluded(origin_circuit_t *circ, const extend_info_t *exit)
|
||||
"prevent this (and possibly break your Tor functionality), "
|
||||
"set the StrictNodes configuration option. "
|
||||
"(Circuit purpose: %s)",
|
||||
description, extend_info_describe(exit),
|
||||
description, extend_info_describe(exit_ei),
|
||||
rs==options->ExcludeNodes?"":" or ExcludeExitNodes",
|
||||
circuit_purpose_to_string(purpose));
|
||||
}
|
||||
|
@ -2374,7 +2374,7 @@ rep_hist_reset_buffer_stats(time_t now)
|
||||
if (!circuits_for_buffer_stats)
|
||||
circuits_for_buffer_stats = smartlist_new();
|
||||
SMARTLIST_FOREACH(circuits_for_buffer_stats, circ_buffer_stats_t *,
|
||||
stat, tor_free(stat));
|
||||
stats, tor_free(stats));
|
||||
smartlist_clear(circuits_for_buffer_stats);
|
||||
start_of_buffer_stats_interval = now;
|
||||
}
|
||||
@ -2415,15 +2415,15 @@ rep_hist_format_buffer_stats(time_t now)
|
||||
buffer_stats_compare_entries_);
|
||||
i = 0;
|
||||
SMARTLIST_FOREACH_BEGIN(circuits_for_buffer_stats,
|
||||
circ_buffer_stats_t *, stat)
|
||||
circ_buffer_stats_t *, stats)
|
||||
{
|
||||
int share = i++ * SHARES / number_of_circuits;
|
||||
processed_cells[share] += stat->processed_cells;
|
||||
queued_cells[share] += stat->mean_num_cells_in_queue;
|
||||
time_in_queue[share] += stat->mean_time_cells_in_queue;
|
||||
processed_cells[share] += stats->processed_cells;
|
||||
queued_cells[share] += stats->mean_num_cells_in_queue;
|
||||
time_in_queue[share] += stats->mean_time_cells_in_queue;
|
||||
circs_in_share[share]++;
|
||||
}
|
||||
SMARTLIST_FOREACH_END(stat);
|
||||
SMARTLIST_FOREACH_END(stats);
|
||||
}
|
||||
|
||||
/* Write deciles to strings. */
|
||||
|
Loading…
Reference in New Issue
Block a user