mirror of
https://github.com/NikitaIvanovV/ctpv.git
synced 2025-03-15 07:29:12 +01:00
Minor
This commit is contained in:
parent
8ee70e735e
commit
6dc8bf1e7a
@ -16,7 +16,7 @@ setup_fifo() {
|
||||
}
|
||||
|
||||
exists() {
|
||||
command -v "$1" > /dev/null
|
||||
command -v "$1" >/dev/null
|
||||
}
|
||||
|
||||
send_image() {
|
||||
|
20
src/lexer.c
20
src/lexer.c
@ -154,10 +154,8 @@ Lexer *lexer_init(FILE *f)
|
||||
|
||||
init_input_buf(&ctx->input_buf, f);
|
||||
ctx->text_buf = ulist_new(sizeof(char), 1024);
|
||||
ctx->line = 1;
|
||||
ctx->col = 1;
|
||||
ctx->tok_queue.back = 0;
|
||||
ctx->tok_queue.front = 0;
|
||||
ctx->line = ctx->col = 1;
|
||||
ctx->tok_queue.back = ctx->tok_queue.front = 0;
|
||||
|
||||
return ctx;
|
||||
}
|
||||
@ -170,8 +168,8 @@ void lexer_free(Lexer *ctx)
|
||||
|
||||
static int cmp_nextn(Lexer *ctx, int n, char *s)
|
||||
{
|
||||
int i = 0;
|
||||
char c;
|
||||
int i = 0;
|
||||
|
||||
while (1) {
|
||||
c = peekn_char(ctx, i);
|
||||
@ -182,10 +180,7 @@ static int cmp_nextn(Lexer *ctx, int n, char *s)
|
||||
i++;
|
||||
}
|
||||
|
||||
if (i == n)
|
||||
return 0;
|
||||
else
|
||||
return ((unsigned char)c - *(unsigned char *)s);
|
||||
return i == n ? 0 : ((unsigned char)c - *(unsigned char *)s);
|
||||
}
|
||||
|
||||
static void ignore_comments(Lexer *ctx)
|
||||
@ -203,12 +198,7 @@ static void read_while(Lexer *ctx, Predicate p, int add)
|
||||
{
|
||||
char c;
|
||||
|
||||
while (1) {
|
||||
c = peek_char(ctx);
|
||||
|
||||
if (c < 0 || !p(c))
|
||||
break;
|
||||
|
||||
while ((c = peek_char(ctx)) >= 0 && p(c)) {
|
||||
if (add)
|
||||
add_text_buf(ctx, c);
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#define ULIST_NODE_SIZE(cap, size) \
|
||||
(sizeof(struct UListNode) - sizeof(void *) + (cap * size))
|
||||
|
||||
#define ULIST_BUF(list) ((void *)&(list).buf)
|
||||
#define ULIST_BUF(node) ((void *)&(node).buf)
|
||||
|
||||
struct UList {
|
||||
size_t size;
|
||||
@ -62,8 +62,7 @@ UList *ulist_new(size_t size, size_t cap)
|
||||
|
||||
l->size = size;
|
||||
l->lock_i = NO_LOCK;
|
||||
l->head = ulist_node_new(l, cap);
|
||||
l->tail = l->head;
|
||||
l->head = l->tail = ulist_node_new(l, cap);
|
||||
|
||||
return l;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user