#include #include #include 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); 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; } // Free allocated token void fzl_freetoken(fzl_token_t *tok) { if (tok->store_value) free(tok->value); free(tok); }