From 0eb8595f05f0b78c82a4f1b6c3d4d145267b0ab6 Mon Sep 17 00:00:00 2001 From: Aaron Taylor Date: Sat, 10 Jul 2021 17:49:17 -0700 Subject: [PATCH] Since we are not longer trying to remain C89 compliant for XScreensaver, reduce the scope of a few loop counters. --- hacks/NEDsim/NEDsim.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hacks/NEDsim/NEDsim.c b/hacks/NEDsim/NEDsim.c index fb4dd72..ad2baaa 100644 --- a/hacks/NEDsim/NEDsim.c +++ b/hacks/NEDsim/NEDsim.c @@ -493,8 +493,7 @@ draw_wordline(struct NEDsim * nedsim, int x, int y) draw_rect_area(nedsim, x, y, WORDLINE_WIDTH, WORDLINE_HEIGHT, False, True, False, False); // Now, draw stripes in the secondary color. - int i; - for (i = 0; i < (WORDLINE_WIDTH/(2*WORDLINE_BITS_PER_STRIPE)); i++) { + for (int i = 0; i < (WORDLINE_WIDTH/(2*WORDLINE_BITS_PER_STRIPE)); i++) { set_color(nedsim, COLOR(secondary)); draw_rect_area(nedsim, (x+(i*(WORDLINE_WIDTH/WORDLINE_BITS_PER_STRIPE))), y, WORDLINE_BITS_PER_STRIPE, WORDLINE_HEIGHT, False, True, False, False); @@ -617,8 +616,7 @@ update_display(struct NEDsim * nedsim) // Draw the SC. - int i; - for (i = 0; i < SC_WIDTH; i++) { + for (int i = 0; i < SC_WIDTH; i++) { if ((SC_WIDTH-1-i) == nedsim->nedstate->active_thread->sc) { set_color(nedsim, COLOR(light_on)); } else { @@ -632,7 +630,7 @@ update_display(struct NEDsim * nedsim) // Draw the stack lights. int64_t top_of_stack = ((int64_t)nedsim->nedstate->active_thread->sp) - 1; - for (i = 0; i < nedsim->num_data_rows; i++) { + for (int i = 0; i < nedsim->num_data_rows; i++) { if ((top_of_stack-i) >= 0) { draw_wordline_lights(nedsim, nedsim->nedstate->active_thread->stack[top_of_stack-i], STACK_X_OFFSET, STACK_Y_OFFSET+STACK_LABEL_HEIGHT+i); } else { @@ -648,7 +646,7 @@ update_display(struct NEDsim * nedsim) draw_text(nedsim, stack_size, (STACK_X_OFFSET+(STACK_WIDTH/2)+1), STACK_Y_OFFSET, STACK_WIDTH, STACK_LABEL_HEIGHT, False); // Draw the heap lights. - for (i = 0; i < nedsim->num_data_rows; i++) { + for (int i = 0; i < nedsim->num_data_rows; i++) { draw_wordline_lights(nedsim, ram_r_word(nedsim->nedstate, HEAP_START_ADDRESS+(i*BPW)), HEAP_X_OFFSET, HEAP_Y_OFFSET+HEAP_LABEL_HEIGHT+i); } } -- 2.20.1