aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lexer.c7
-rw-r--r--src/util.c15
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);
}
diff --git a/src/util.c b/src/util.c
index 256371f..02d7271 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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");
}