diff --git a/src/lexer.c b/src/lexer.c index 6ab40c4..9043d35 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -76,13 +76,11 @@ static int peekn_char(Lexer *ctx, unsigned int i) if (i > 0) { assert(i < LEN(b->buf)); - memmove(b->buf, b->buf + (b->len - i) * sizeof(*b->buf), - i * sizeof(*b->buf)); + memmove(b->buf, b->buf + (b->len - i), i * sizeof(*b->buf)); } b->pos = 0; - b->len = fread(b->buf + i * sizeof(*b->buf), sizeof(*b->buf), - LEN(b->buf) - i, b->f); + b->len = fread(b->buf + i, sizeof(*b->buf), LEN(b->buf) - i, b->f); if (b->len != LEN(b->buf)) { if (feof(b->f)) @@ -185,7 +183,7 @@ static int cmp_nextn(Lexer *ctx, int n, char *s) if (i >= n || *s == '\0' || c != *s) break; - s += sizeof(*s); + s++; i++; } diff --git a/src/shell.c b/src/shell.c index a410107..52359d2 100644 --- a/src/shell.c +++ b/src/shell.c @@ -23,7 +23,7 @@ char *prepend_helpers(char *str, size_t len) l = helpers_len; memcpy(b, scr_helpers_sh, l * sizeof(*b)); - b += l * sizeof(*str); + b += l; l = len; memcpy(b, str, l * sizeof(*b)); diff --git a/src/utils.c b/src/utils.c index c59298f..426b649 100644 --- a/src/utils.c +++ b/src/utils.c @@ -136,7 +136,7 @@ const char *get_ext(const char *path) const char *base; if ((base = strrchr(path, '/'))) - base += sizeof(*base); + base++; else base = path;