Skip to content

Commit d2acd20

Browse files
committed
Code cleanup
1 parent a62f3c9 commit d2acd20

File tree

4 files changed

+118
-112
lines changed

4 files changed

+118
-112
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ jobs:
7272
sudo apt-get install -q -y qemu-user
7373
sudo apt-get install -q -y build-essential
7474
- name: Configurate config
75-
env:
76-
CC: ${{ matrix.compiler }}
7775
run: |
7876
make distclean config ARCH=${{ matrix.architecture }}
7977
- name: Preprocess stage 1 source code
78+
env:
79+
CC: ${{ matrix.compiler }}
8080
run: |
8181
make out/shecc
8282
./out/shecc -E src/main.c > ./out/out.c

src/globals.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1697,7 +1697,7 @@ void error_at(char *msg, source_location_t *loc)
16971697
/* FIXME: This function has been deprecated, use `error_at` instead. */
16981698
void error(char *msg)
16991699
{
1700-
printf("[Error]: %s.\n");
1700+
printf("[Error]: %s.\n", msg);
17011701
abort();
17021702
}
17031703

src/lexer.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ token_t *lex_token(strbuf_t *buf, source_location_t *loc, token_t *prev)
420420

421421
token_buffer[sz] = '\0';
422422
token = new_token(T_numeric, loc, sz);
423-
token->literal = arena_strdup(TOKEN_ARENA, token_buffer);
423+
token->literal = intern_string(token_buffer);
424424
loc->column += sz;
425425
return token;
426426
}
@@ -523,7 +523,7 @@ token_t *lex_token(strbuf_t *buf, source_location_t *loc, token_t *prev)
523523

524524
read_char(buf);
525525
token = new_token(T_string, loc, sz + 2);
526-
token->literal = arena_strdup(TOKEN_ARENA, token_buffer);
526+
token->literal = intern_string(token_buffer);
527527
loc->column += sz + 2;
528528
return token;
529529
}
@@ -557,8 +557,8 @@ token_t *lex_token(strbuf_t *buf, source_location_t *loc, token_t *prev)
557557

558558
read_char(buf);
559559
token = new_token(T_char, loc, sz + 2);
560-
token->literal = arena_strdup(TOKEN_ARENA, token_buffer);
561-
loc->column = sz + 2;
560+
token->literal = intern_string(token_buffer);
561+
loc->column += sz + 2;
562562
return token;
563563
}
564564

@@ -906,7 +906,7 @@ token_t *lex_token(strbuf_t *buf, source_location_t *loc, token_t *prev)
906906
kind = lookup_keyword(token_buffer);
907907

908908
token = new_token(kind, loc, sz);
909-
token->literal = arena_strdup(TOKEN_ARENA, token_buffer);
909+
token->literal = intern_string(token_buffer);
910910
loc->column += sz;
911911
return token;
912912
}

0 commit comments

Comments
 (0)