From b8ce51b85fe340e7b6bb0e9e03c8b867534fba10 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sun, 17 Dec 2023 01:55:22 +0100 Subject: Added and made use of fencmp() --- FICS/eco.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/FICS/eco.c b/FICS/eco.c index 7d67726..f46b116 100644 --- a/FICS/eco.c +++ b/FICS/eco.c @@ -19,6 +19,12 @@ LONG_entry *LONG_book[4096]; int ECO_entries, NIC_entries, LONG_entries; +PRIVATE int +fencmp(const unsigned char *pos1, const char *pos2) +{ + return strcmp((const char *)pos1, pos2); +} + PUBLIC char * boardToFEN(int g) { @@ -317,13 +323,13 @@ getECO(int g) while ((r >= l) && !flag) { x = ((l + r) / 2); - if (strcmp(garray[g].moveList[i].FENpos, + if (fencmp(garray[g].moveList[i].FENpos, ECO_book[x]->FENpos) < 0) r = (x - 1); else l = (x + 1); - if (!strcmp(garray[g].moveList[i].FENpos, + if (!fencmp(garray[g].moveList[i].FENpos, ECO_book[x]->FENpos)) { strcpy(ECO, ECO_book[x]->ECO); flag = 1; @@ -399,13 +405,13 @@ com_eco(int p, param_list param) while (r >= l && !flag) { x = ((l + r) / 2); - if (strcmp(garray[g1].moveList[i].FENpos, + if (fencmp(garray[g1].moveList[i].FENpos, ECO_book[x]->FENpos) < 0) r = (x - 1); else l = (x + 1); - if (!strcmp(garray[g1].moveList[i].FENpos, + if (!fencmp(garray[g1].moveList[i].FENpos, ECO_book[x]->FENpos)) { pprintf(p, " ECO[%3d]: %s\n", i, ECO_book[x]->ECO); @@ -429,13 +435,13 @@ com_eco(int p, param_list param) while (r >= l && !flag) { x = ((l + r) / 2); - if (strcmp(garray[g1].moveList[i].FENpos, + if (fencmp(garray[g1].moveList[i].FENpos, NIC_book[x]->FENpos) < 0) r = (x - 1); else l = (x + 1); - if (!strcmp(garray[g1].moveList[i].FENpos, + if (!fencmp(garray[g1].moveList[i].FENpos, NIC_book[x]->FENpos)) { pprintf(p, " NIC[%3d]: %s\n", i, NIC_book[x]->NIC); @@ -459,13 +465,13 @@ com_eco(int p, param_list param) while (r >= l && !flag) { x = ((l + r) / 2); - if (strcmp(garray[g1].moveList[i].FENpos, + if (fencmp(garray[g1].moveList[i].FENpos, LONG_book[x]->FENpos) < 0) r = (x - 1); else l = (x + 1); - if (!strcmp(garray[g1].moveList[i].FENpos, + if (!fencmp(garray[g1].moveList[i].FENpos, LONG_book[x]->FENpos)) { pprintf(p, " LONG[%3d]: %s\n", i, LONG_book[x]->LONG); -- cgit v1.2.3