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>
(cherry picked from commit 6e29dce291)
This commit is contained in:
Timothy Arceri 2023-02-15 23:13:06 +11:00 committed by Eric Engestrom
parent 49f745a617
commit 2da88f4bf7
2 changed files with 16 additions and 1 deletions

View file

@ -1039,7 +1039,7 @@
"description": "glsl: add _token_list_prepend() helper to the parser",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -99,6 +99,9 @@ _token_create_ival(glcpp_parser_t *parser, int type, int ival);
static token_list_t *
_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
_token_list_append(glcpp_parser_t *parser, token_list_t *list, token_t *token);
@ -1088,6 +1091,18 @@ _token_list_create(glcpp_parser_t *parser)
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
_token_list_append(glcpp_parser_t *parser, token_list_t *list, token_t *token)
{