--- uae/src/cpuopti.c 2018/04/24 16:44:38 1.1.1.4 +++ uae/src/cpuopti.c 2018/04/24 17:01:41 1.1.1.6 @@ -11,8 +11,6 @@ #include "sysdeps.h" #include -#include "options.h" - struct line { struct line *next, *prev; int delet; @@ -30,6 +28,33 @@ static void oops(void) abort(); } +/* Not strictly true to definition, as it only checks for match/no match, + not for ordering */ +static int mystrncmp(const char* a, const char* b, int len) +{ + int biswhite=0; + while (len) { + if (isspace(*a)) { + if (!biswhite) { + biswhite=isspace(*b++); + while (isspace(*b)) + b++; + } + if (!biswhite) + return -1; + } + else { + biswhite=0; + if (*a!=*b++) + return -1; + } + a++; + len--; + } + return 0; +} + + static char * match(struct line *l, const char *m) { char *str = l->data; @@ -37,7 +62,7 @@ static char * match(struct line *l, cons while (isspace(*str)) str++; - if (strncmp(str, m, len) != 0) + if (mystrncmp(str, m, len) != 0) return NULL; return str + len; } @@ -249,7 +274,7 @@ int main(int argc, char **argv) if (s != NULL) *s = 0; - if (strncmp(tmp, ".globl op_", 10) == 0) { + if (mystrncmp(tmp, ".globl op_", 10) == 0) { struct line *first_line = NULL, *prev = NULL; struct line **nextp = &first_line; struct func f;