Skip to content

Commit

Permalink
Replace all getc/ungetc with new wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhutchings committed Jun 26, 2024
1 parent 4cc27de commit 8910d5a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lexer/lex.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@ int real_lex(Lexer *l, Token *t) {
// return./
if (starts_operator(init)) {
while (valid_operator_sequence(t->contents)) {
t->contents[pos++] = (c = getc(l->fp));
t->contents[pos++] = (c = lexer_getchar(l->fp));
}
// We've ended!
// Can we reduce this code duplication from above in a smart way?
ungetc(c, l->fp);
lexer_ungetchar(l);
t->contents[pos - 1] = '\0';
t->type = ttype_from_string(t->contents);
t->length = pos;
Expand Down

0 comments on commit 8910d5a

Please sign in to comment.