File: do-not-use-global-variable-as-counter.patch

package info (click to toggle)
xsok 1.02-19
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 1,836 kB
  • sloc: ansic: 3,990; makefile: 104; sh: 22
file content (28 lines) | stat: -rw-r--r-- 717 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From: Bertram Felgenhauer <int-e@gmx.de>
Date: Fri, 7 Oct 2016 00:29:52 +0200
Subject: do not use global variable as counter

Debian-Bug: https://bugs.debian.org/382550
Forwarded: no
---
 src/commands.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/commands.c b/src/commands.c
index e7e1132..11c3543 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -54,9 +54,10 @@ void cmd_LevelInfo(void) {
 }
 
 void cmd_NextUnsolved(void) {
-    while (game.level < maxlevel) {
-	if (!highscore[++game.level]) {
-	    NewLevel(game.level);
+    int level = game.level;
+    while (level < maxlevel) {
+	if (!highscore[++level]) {
+	    NewLevel(level);
 	    cmd_LevelInfo();
 	    return;
 	}