Skip to content

Commit

Permalink
Fix conflict with GNU strchnul
Browse files Browse the repository at this point in the history
  • Loading branch information
bamless committed May 18, 2024
1 parent e6cb216 commit 7f5ed52
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/parse/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static void endFunction(Parser* p) {
// ERROR REPORTING FUNCTIONS
// -----------------------------------------------------------------------------

static char* strchrnul(const char* str, char c) {
static char* strchrWithNul(const char* str, char c) {
char* ret;
return (ret = strchr(str, c)) == NULL ? strchr(str, '\0') : ret;
}
Expand Down Expand Up @@ -113,7 +113,7 @@ static void error(Parser* p, const char* msg, ...) {
char error[MAX_ERR_SIZE];
p->lineStart = correctEscapedNewlines(p->lineStart, errorTok->lexeme);
int tokenCol = errorTok->lexeme - p->lineStart;
int lineLen = strchrnul(errorTok->lexeme, '\n') - p->lineStart;
int lineLen = strchrWithNul(errorTok->lexeme, '\n') - p->lineStart;

int pos = printSourceSnippet(error, p->lineStart, lineLen, tokenCol);

Expand Down

0 comments on commit 7f5ed52

Please sign in to comment.