diff options
author | s-over-4 | 2023-06-15 19:01:32 -0400 |
---|---|---|
committer | s-over-4 | 2023-06-15 19:01:32 -0400 |
commit | c7d0b43b200ee2103653468c76050c1113299fea (patch) | |
tree | c28d081e2ba7f64fbd93154ebec555bb22a8e9d1 /src | |
parent | 4c41e9f95d23f9ba322b2516164cd4bab0b439fa (diff) |
fixed everything and changed Makefile a bit
Diffstat (limited to 'src')
-rw-r--r-- | src/lexer.c | 7 | ||||
-rw-r--r-- | src/util.c | 15 |
2 files changed, 3 insertions, 19 deletions
diff --git a/src/lexer.c b/src/lexer.c index 1f647f5..60fa1a5 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -126,12 +126,11 @@ token_t* lexer_collect(lexer_t* lexer, int (*end_char)(char), int fskip, int lsk char* current = lexer_get_c_as_string(lexer); token = realloc( token, - (len + strlen(current) * sizeof(char)) + (len + sizeof(char) * strlen(current)) ); - memcpy(token + len, current, strlen(current) * sizeof(char)); - len += strlen(current) * sizeof(char); - free(current); + memcpy(token + len, current, sizeof(char) * strlen(current)); + len += sizeof(char) * strlen(current); lexer_next(lexer); } @@ -8,14 +8,6 @@ void die(const char* fmt, ...) { va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); - - if (fmt[0] && fmt[strlen(fmt) - 1] == ':') { - fputc(' ', stderr); - perror(NULL); - } else { - fputc('\n', stderr); - } - fprintf(stderr, "\n"); exit(1); @@ -49,12 +41,5 @@ void log_war(const char* fmt, ...) { vfprintf(stderr, fmt, ap); va_end(ap); - if (fmt[0] && fmt[strlen(fmt) - 1] == ':') { - fputc(' ', stderr); - perror(NULL); - } else { - fputc('\n', stderr); - } - fprintf(stderr, "\n"); } |