This commit is contained in:
Nikita Ivanov 2022-06-10 14:00:43 +05:00
parent f850b4b116
commit ca85b5c017
No known key found for this signature in database
GPG Key ID: 6E656AC5B97B5133
3 changed files with 5 additions and 7 deletions

View File

@ -76,13 +76,11 @@ static int peekn_char(Lexer *ctx, unsigned int i)
if (i > 0) { if (i > 0) {
assert(i < LEN(b->buf)); assert(i < LEN(b->buf));
memmove(b->buf, b->buf + (b->len - i) * sizeof(*b->buf), memmove(b->buf, b->buf + (b->len - i), i * sizeof(*b->buf));
i * sizeof(*b->buf));
} }
b->pos = 0; b->pos = 0;
b->len = fread(b->buf + i * sizeof(*b->buf), sizeof(*b->buf), b->len = fread(b->buf + i, sizeof(*b->buf), LEN(b->buf) - i, b->f);
LEN(b->buf) - i, b->f);
if (b->len != LEN(b->buf)) { if (b->len != LEN(b->buf)) {
if (feof(b->f)) 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) if (i >= n || *s == '\0' || c != *s)
break; break;
s += sizeof(*s); s++;
i++; i++;
} }

View File

@ -23,7 +23,7 @@ char *prepend_helpers(char *str, size_t len)
l = helpers_len; l = helpers_len;
memcpy(b, scr_helpers_sh, l * sizeof(*b)); memcpy(b, scr_helpers_sh, l * sizeof(*b));
b += l * sizeof(*str); b += l;
l = len; l = len;
memcpy(b, str, l * sizeof(*b)); memcpy(b, str, l * sizeof(*b));

View File

@ -136,7 +136,7 @@ const char *get_ext(const char *path)
const char *base; const char *base;
if ((base = strrchr(path, '/'))) if ((base = strrchr(path, '/')))
base += sizeof(*base); base++;
else else
base = path; base = path;