various: tidy up variable scopes, and one name mismatch

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2019-03-26 21:26:51 +00:00
parent 4f64902a9e
commit 17d68b7e3e
No known key found for this signature in database
GPG key ID: 0D46FEF7E61DBB46
3 changed files with 7 additions and 6 deletions

View file

@ -279,7 +279,7 @@ extern void set_ipv_functions(struct conf_t *state, int version);
extern void flip_ranges(struct conf_t *state);
extern void clean_up(struct conf_t *state);
extern void parse_cidr(struct conf_t *state, struct range_t *range_p, const char *word);
extern int parse_color_mode(const char *restrict optarg);
extern int parse_color_mode(const char *restrict arg);
extern double strtod_or_err(const char *restrict str, const char *restrict errmesg);
extern void __attribute__ ((noreturn)) print_version(void);
extern void __attribute__ ((noreturn)) usage(int status);

View file

@ -219,7 +219,6 @@ static void close_outfile(FILE *outfile)
/*! \brief Text output format, which is the default. */
static int output_txt(struct conf_t *state)
{
unsigned int i;
struct range_t *range_p;
struct shared_network_t *shared_p;
struct output_helper_t oh;
@ -249,6 +248,7 @@ static int output_txt(struct conf_t *state)
fprintf(outfile, "\n");
}
if (state->number_limit & R_BIT) {
unsigned int i;
for (i = 0; i < state->num_ranges; i++) {
int color_set = 0;
@ -366,7 +366,6 @@ static int output_txt(struct conf_t *state)
/*! \brief The xml output formats. */
static int output_xml(struct conf_t *state)
{
unsigned int i;
struct range_t *range_p;
struct shared_network_t *shared_p;
struct output_helper_t oh;
@ -394,6 +393,7 @@ static int output_xml(struct conf_t *state)
}
if (state->number_limit & R_BIT) {
unsigned int i;
for (i = 0; i < state->num_ranges; i++) {
if (range_output_helper(state, &oh, range_p)) {
range_p++;
@ -762,7 +762,6 @@ static void newsection(FILE *restrict f, char const *restrict title)
/*! \brief Output html format. */
static int output_html(struct conf_t *state)
{
unsigned int i;
struct range_t *range_p;
struct shared_network_t *shared_p;
struct output_helper_t oh;
@ -877,6 +876,7 @@ static int output_html(struct conf_t *state)
end_tag(outfile, "thead");
}
if (state->number_limit & R_BIT) {
unsigned int i;
start_tag(outfile, "tbody");
for (i = 0; i < state->num_ranges; i++) {
if (range_output_helper(state, &oh, range_p)) {
@ -916,7 +916,6 @@ static int output_html(struct conf_t *state)
/*! \brief Output cvs format. */
static int output_csv(struct conf_t *state)
{
unsigned int i;
struct range_t *range_p;
struct shared_network_t *shared_p;
struct output_helper_t oh;
@ -935,6 +934,7 @@ static int output_csv(struct conf_t *state)
fprintf(outfile, "\n");
}
if (state->number_limit & R_BIT) {
unsigned int i;
for (i = 0; i < state->num_ranges; i++) {
if (range_output_helper(state, &oh, range_p)) {
range_p++;

View file

@ -286,7 +286,6 @@ void mergesort_ranges(struct conf_t *state, struct range_t *restrict orig, unsig
struct range_t *restrict temp, const int root_call)
{
unsigned int left, i, u_right;
int s_right;
struct range_t hold;
/* Merge sort split size */
static const unsigned int MIN_MERGE_SIZE = 8;
@ -296,6 +295,8 @@ void mergesort_ranges(struct conf_t *state, struct range_t *restrict orig, unsig
if (size < MIN_MERGE_SIZE) {
for (left = 0; left < size; left++) {
int s_right;
hold = *(orig + left);
for (s_right = left - 1; 0 <= s_right; s_right--) {
if (merge(state, (orig + s_right), &hold))