commit 55590cec7b84c7dc1006f4ae3cd812059d73f58b
parent 9aed17b97787d20113d6906138f9ef37b3109143
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date: Sun, 10 Oct 2021 20:09:20 +0100
Fixed "while loop has empty body" warning with macOS compiler
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/uxnasm.c b/src/uxnasm.c
@@ -51,7 +51,7 @@ static int cpos(char *s, char a){ int i = 0; char c; while((c = s[i++])) if(c
static int scmp(char *a, char *b, int len) { int i = 0; while(a[i] == b[i]) if(!a[i] || ++i >= len) return 1; return 0; } /* string compare */
static int sihx(char *s) { int i = 0; char c; while((c = s[i++])) if(!(c >= '0' && c <= '9') && !(c >= 'a' && c <= 'f')) return 0; return i > 1; } /* string is hexadecimal */
static int shex(char *s) { int n = 0, i = 0; char c; while((c = s[i++])) if(c >= '0' && c <= '9') n = n * 16 + (c - '0'); else if(c >= 'a' && c <= 'f') n = n * 16 + 10 + (c - 'a'); return n; } /* string to num */
-static int slen(char *s) { int i = 0; while(s[i] && s[++i]) ; return i; } /* string length */
+static int slen(char *s) { int i = 0; while(s[i]) ++i; return i; } /* string length */
static char *scpy(char *src, char *dst, int len) { int i = 0; while((dst[i] = src[i]) && i < len - 2) i++; dst[i + 1] = '\0'; return dst; } /* string copy */
static char *scat(char *dst, const char *src) { char *ptr = dst + slen(dst); while(*src) *ptr++ = *src++; *ptr = '\0'; return dst; } /* string cat */