glsl: add _token_list_prepend() helper to the parser

This will be used in the following patch.

Cc: mesa-stable
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21352>
This commit is contained in:
Timothy Arceri
2023-02-15 23:13:06 +11:00
committed by Marge Bot
parent 2c40215ab9
commit 6e29dce291

View File

@@ -99,6 +99,9 @@ _token_create_ival(glcpp_parser_t *parser, int type, int ival);
static token_list_t * static token_list_t *
_token_list_create(glcpp_parser_t *parser); _token_list_create(glcpp_parser_t *parser);
static void
_token_list_prepend(glcpp_parser_t *parser, token_list_t *list, token_t *token);
static void static void
_token_list_append(glcpp_parser_t *parser, token_list_t *list, token_t *token); _token_list_append(glcpp_parser_t *parser, token_list_t *list, token_t *token);
@@ -1090,6 +1093,18 @@ _token_list_create(glcpp_parser_t *parser)
return list; return list;
} }
void
_token_list_prepend(glcpp_parser_t *parser, token_list_t *list, token_t *token)
{
token_node_t *node;
node = linear_alloc_child(parser->linalloc, sizeof(token_node_t));
node->token = token;
node->next = list->head;
list->head = node;
}
void void
_token_list_append(glcpp_parser_t *parser, token_list_t *list, token_t *token) _token_list_append(glcpp_parser_t *parser, token_list_t *list, token_t *token)
{ {