From a2f52867ad6e4cbdef43f4c28a57a5fba73417d5 Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 9 Apr 2021 14:24:25 -0400 Subject: [PATCH] Rename `print` to `printChar` This clarifies its usage, for printing a single character in error messages. --- include/asm/util.h | 2 +- src/asm/lexer.c | 10 +++++----- src/asm/util.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/asm/util.h b/include/asm/util.h index 84728021..30f96102 100644 --- a/include/asm/util.h +++ b/include/asm/util.h @@ -12,7 +12,7 @@ #include uint32_t calchash(const char *s); -char const *print(int c); +char const *printChar(int c); /* * @return The number of bytes read, or 0 if invalid data was found */ diff --git a/src/asm/lexer.c b/src/asm/lexer.c index 1d453b51..54743bf7 100644 --- a/src/asm/lexer.c +++ b/src/asm/lexer.c @@ -1173,7 +1173,7 @@ static void readLineContinuation(void) discardComment(); } else { error("Begun line continuation, but encountered character %s\n", - print(c)); + printChar(c)); return; } } @@ -1631,7 +1631,7 @@ static void readString(void) break; default: - error("Illegal character escape %s\n", print(c)); + error("Illegal character escape %s\n", printChar(c)); shiftChars(1); break; } @@ -1781,7 +1781,7 @@ static size_t appendStringLiteral(size_t i) break; default: - error("Illegal character escape %s\n", print(c)); + error("Illegal character escape %s\n", printChar(c)); shiftChars(1); break; } @@ -2069,7 +2069,7 @@ static int yylex_NORMAL(void) /* Do not report weird characters when capturing, it'll be done later */ if (!lexerState->capturing) { /* TODO: try to group reportings */ - error("Unknown character %s\n", print(c)); + error("Unknown character %s\n", printChar(c)); } } lexerState->atLineStart = false; @@ -2157,7 +2157,7 @@ static int yylex_RAW(void) */ default: - error("Illegal character escape %s\n", print(c)); + error("Illegal character escape %s\n", printChar(c)); break; } /* fallthrough */ diff --git a/src/asm/util.c b/src/asm/util.c index 6f3b4658..be961a60 100644 --- a/src/asm/util.c +++ b/src/asm/util.c @@ -30,7 +30,7 @@ uint32_t calchash(const char *s) return hash; } -char const *print(int c) +char const *printChar(int c) { // "'A'" + '\0': 4 bytes // "'\\n'" + '\0': 5 bytes