From 9352746b95920fc75dfd8c01ecac048e79b7ae02 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sun, 28 Nov 2021 10:16:52 +0100 Subject: Added possibility of having end-of-line comments with double slash (single slash actually); fixed a small memory leak --- Makefile | 2 +- nissy-2.0beta3.tar.gz | Bin 53230 -> 0 bytes nissy-2.0beta4.tar.gz | Bin 0 -> 53130 bytes nissy.exe | Bin 633301 -> 633813 bytes src/alg.c | 15 +++++++++++++-- 5 files changed, 14 insertions(+), 3 deletions(-) delete mode 100644 nissy-2.0beta3.tar.gz create mode 100644 nissy-2.0beta4.tar.gz diff --git a/Makefile b/Makefile index 85d696e..71e2297 100644 --- 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 deleted file mode 100644 index 91c9e5e..0000000 Binary files a/nissy-2.0beta3.tar.gz and /dev/null differ diff --git a/nissy-2.0beta4.tar.gz b/nissy-2.0beta4.tar.gz new file mode 100644 index 0000000..4de4695 Binary files /dev/null and b/nissy-2.0beta4.tar.gz differ diff --git a/nissy.exe b/nissy.exe index e036d43..8e781d1 100755 Binary files a/nissy.exe and b/nissy.exe differ diff --git a/src/alg.c b/src/alg.c index cd6834c..4e96925 100644 --- 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(""); } } -- cgit v1.3