nissy-fmc

A Rubik's cube FMC assistant
git clone https://git.tronto.net/nissy-fmc
Download | Log | Files | Refs | README | LICENSE

commit 084431648827d9218ebca679e0a3092e31bc570f
parent 24b790ac81b0a7a9ca6f71564e066a978981b866
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Sat,  6 May 2023 23:33:57 +0200

Re-added harmless includes

Diffstat:
Msrc/coord.c | 3++-
Msrc/cube.c | 1+
Msrc/cube.h | 3---
Msrc/nissy.c | 29+++++++++--------------------
Msrc/solve.c | 1+
Msrc/steps.c | 1+
6 files changed, 14 insertions(+), 24 deletions(-)

diff --git a/src/coord.c b/src/coord.c @@ -1,7 +1,8 @@ +#include <inttypes.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <inttypes.h> #include "cube.h" #include "coord.h" diff --git a/src/cube.c b/src/cube.c @@ -1,3 +1,4 @@ +#include <stdbool.h> #include "cube.h" static void apply_permutation(int *, int *, int, int *); diff --git a/src/cube.h b/src/cube.h @@ -1,12 +1,9 @@ -#define false 0 -#define true 1 #define NMOVES 55 #define NTRANS 48 #define MAX_ALG_LEN 22 #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #define MAX(a,b) (((a) > (b)) ? (a) : (b)) -typedef int bool; typedef enum edge { UF, UL, UB, UR, DF, DL, DB, DR, FR, FL, BL, BR } Edge; typedef enum { UFR, UFL, UBL, UBR, DFR, DFL, DBL, DBR } Corner; typedef enum { diff --git a/src/nissy.c b/src/nissy.c @@ -1,5 +1,7 @@ #include <inttypes.h> +#include <stdbool.h> #include <stddef.h> +#include <string.h> #include "cube.h" #include "coord.h" @@ -9,19 +11,6 @@ static bool set_step(char *, Step **); static bool set_solutiontype(char *, SolutionType *); static bool set_trans(char *, Trans *); -static bool strequal(char *, char *); - -static bool -strequal(char *s1, char *s2) -{ - int i; - - for (i = 0; s1[i] && s2[i]; i++) - if (s1[i] != s2[i]) - return false; - - return true; -} static bool set_step(char *str, Step **step) @@ -29,7 +18,7 @@ set_step(char *str, Step **step) int i; for (i = 0; steps[i] != NULL; i++) { - if (strequal(steps[i]->shortname, str)) { + if (!strcmp(steps[i]->shortname, str)) { *step = steps[i]; return true; } @@ -41,15 +30,15 @@ set_step(char *str, Step **step) static bool set_solutiontype(char *str, SolutionType *st) { - if (strequal(str, "normal")) { + if (!strcmp(str, "normal")) { *st = NORMAL; return true; } - if (strequal(str, "inverse")) { + if (!strcmp(str, "inverse")) { *st = INVERSE; return true; } - if (strequal(str, "niss")) { + if (!strcmp(str, "niss")) { *st = NISS; return true; } @@ -60,15 +49,15 @@ set_solutiontype(char *str, SolutionType *st) static bool set_trans(char *str, Trans *t) { - if (strequal(str, "uf")) { + if (!strcmp(str, "uf")) { *t = uf; return true; } - if (strequal(str, "fr")) { + if (!strcmp(str, "fr")) { *t = fr; return true; } - if (strequal(str, "rd")) { + if (!strcmp(str, "rd")) { *t = rd; return true; } diff --git a/src/solve.c b/src/solve.c @@ -1,3 +1,4 @@ +#include <stdbool.h> #include <stddef.h> #include <inttypes.h> diff --git a/src/steps.c b/src/steps.c @@ -1,4 +1,5 @@ #include <inttypes.h> +#include <stdbool.h> #include <stddef.h> #include "cube.h"