commit 9352746b95920fc75dfd8c01ecac048e79b7ae02
parent 0f65f1b71124cb974cf06c32439c2a2bad422659
Author: Sebastiano Tronto <sebastiano.tronto@gmail.com>
Date: Sun, 28 Nov 2021 10:16:52 +0100
Added possibility of having end-of-line comments with double slash (single slash actually); fixed a small memory leak
Diffstat:
5 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,6 +1,6 @@
# See LICENSE file for copyright and license details.
-VERSION = 2.0beta3
+VERSION = 2.0beta4
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man
diff --git a/nissy-2.0beta3.tar.gz b/nissy-2.0beta3.tar.gz
Binary files differ.
diff --git a/nissy-2.0beta4.tar.gz b/nissy-2.0beta4.tar.gz
Binary files differ.
diff --git a/nissy.exe b/nissy.exe
Binary files differ.
diff --git a/src/alg.c b/src/alg.c
@@ -230,6 +230,17 @@ new_alg(char *str)
continue;
}
+ /* Single slash for comments */
+ if (str[i] == '/') {
+ while (str[i] && str[i] != '\n')
+ i++;
+
+ if (!str[i])
+ i--;
+
+ continue;
+ }
+
move_read = false;
for (j = U; j < NMOVES; j++) {
if (str[i] == move_string(j)[0] ||
@@ -270,8 +281,8 @@ new_alg(char *str)
}
if (!move_read) {
- alg = new_alg("");
- return alg;
+ free(alg);
+ return new_alg("");
}
}