feat: add code style rules

This commit is contained in:
samsonium
2026-10-09 23:01:19 +03:00
parent 45206e3d07
commit 1d7cc88c22
11 changed files with 562 additions and 474 deletions
+15 -16
View File
@@ -2,28 +2,27 @@
#include <stdlib.h>
#include <string.h>
fzl_token_t *fzl_mktoken(
const fzl_toktype_t type, uint16_t from, uint16_t to,
void *value, size_t value_len)
fzl_token_t *fzl_mktoken(const fzl_toktype_t type, uint16_t from, uint16_t to,
void *value, size_t value_len)
{
void *valholder = malloc(value_len);
memcpy(valholder, value, value_len);
void *valholder = malloc(value_len);
memcpy(valholder, value, value_len);
fzl_token_t *token = malloc(sizeof(fzl_token_t));
token->type = type;
token->i0 = from;
token->i1 = to;
token->store_value = value_len > 0;
token->value = valholder;
token->value_sz = value_len;
fzl_token_t *token = malloc(sizeof(fzl_token_t));
token->type = type;
token->i0 = from;
token->i1 = to;
token->store_value = value_len > 0;
token->value = valholder;
token->value_sz = value_len;
return token;
return token;
}
// Free allocated token
void fzl_freetoken(fzl_token_t *tok)
{
if (tok->store_value) free(tok->value);
free(tok);
if (tok->store_value)
free(tok->value);
free(tok);
}