ls

simple syscall based programming language from scratch
git clone git://git.kocotian.pl/ls.git
Log | Files | Refs | README | LICENSE

commit e332c3b5aa3c322f83036a090d939229875774ba
parent e848a314d2c1af0d3f6e73a9b1dbdcfb0c5e55ce
Author: kocotian <kocotian@kocotian.pl>
Date:   Tue, 30 Mar 2021 22:34:25 +0200

A few small changes

Diffstat:
Mgrammar.c | 8++------
Mutil.c | 2+-
2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/grammar.c b/grammar.c @@ -278,17 +278,13 @@ g_function(Token *tokens, size_t toksize) } while (tokens[i].type == TokenComma); g_expecttype(tokens[i++], TokenClosingParenthesis); - rb = snprintf(buffer, BUFSIZ, "\n%s:\n\tpush rbp\n", + ASMCONCAT("\n%s:\n\tpush rbp\n\tmov rbp, rsp\n", func_name); - output = realloc(output, outsiz += rb); - strcat(output, buffer); free(func_name); i += g_statement(tokens + i, toksize - i); - rb = snprintf(buffer, BUFSIZ, "\tpop rbp\n\tret\n"); - output = realloc(output, outsiz += rb); - strcat(output, buffer); + ASMCONCAT("\tpop rbp\n\tret\n"); return ++i; } diff --git a/util.c b/util.c @@ -76,7 +76,7 @@ strlchlen(const char *s, char c) char *p; if ((p = strchr(s, c)) == NULL) return strlen(s); - while ((p = strchr(p, c) != NULL)) + while ((p = strchr(p, c)) != NULL); return p - s; }