On Wed, Oct 12, 2016 at 3:11 PM, Nicolai Hähnle <nhaeh...@gmail.com> wrote: > On 08.10.2016 12:58, Marek Olšák wrote: >> >> From: Marek Olšák <marek.ol...@amd.com> >> >> --- >> src/compiler/glsl/glcpp/glcpp-lex.l | 2 +- >> src/compiler/glsl/glcpp/glcpp-parse.y | 203 >> +++++++++++++++------------------- >> src/compiler/glsl/glcpp/glcpp.h | 1 + >> 3 files changed, 94 insertions(+), 112 deletions(-) >> >> diff --git a/src/compiler/glsl/glcpp/glcpp-lex.l >> b/src/compiler/glsl/glcpp/glcpp-lex.l >> index d09441a..f4a6876 100644 >> --- a/src/compiler/glsl/glcpp/glcpp-lex.l >> +++ b/src/compiler/glsl/glcpp/glcpp-lex.l > > [snip] > >> @@ -1002,51 +994,50 @@ _token_list_append_list(token_list_t *list, >> token_list_t *tail) >> list->head = tail->head; >> } else { >> list->tail->next = tail->head; >> } >> >> list->tail = tail->tail; >> list->non_space_tail = tail->non_space_tail; >> } >> >> static token_list_t * >> -_token_list_copy(void *ctx, token_list_t *other) >> +_token_list_copy(glcpp_parser_t *parser, token_list_t *other) >> { >> token_list_t *copy; >> token_node_t *node; >> >> if (other == NULL) >> return NULL; >> >> - copy = _token_list_create (ctx); >> + copy = _token_list_create (parser); >> for (node = other->head; node; node = node->next) { >> - token_t *new_token = ralloc (copy, token_t); >> + token_t *new_token = linear_alloc_child(parser->linalloc, >> sizeof(token_t)); >> *new_token = *node->token; >> - _token_list_append (copy, new_token); >> + _token_list_append (parser, copy, new_token); >> } >> >> return copy; >> } >> >> static void >> _token_list_trim_trailing_space(token_list_t *list) >> { >> token_node_t *tail, *next; >> >> if (list->non_space_tail) { >> tail = list->non_space_tail->next; >> list->non_space_tail->next = NULL; >> list->tail = list->non_space_tail; >> >> while (tail) { >> next = tail->next; >> - ralloc_free (tail); >> tail = next; >> } > > > This whole loop can be dropped now. > > >> } >> } >> >> static int >> _token_list_is_empty_ignoring_space(token_list_t *l) >> { >> token_node_t *n; >> >> @@ -1177,69 +1168,70 @@ _token_print(char **out, size_t *len, token_t >> *token) >> case PLACEHOLDER: >> /* Nothing to print. */ >> break; >> default: >> assert(!"Error: Don't know how to print token."); >> >> break; >> } >> } >> >> -/* Return a new token (ralloc()ed off of 'token') formed by pasting >> - * 'token' and 'other'. Note that this function may return 'token' or >> - * 'other' directly rather than allocating anything new. >> +/* Return a new token formed by pasting 'token' and 'other'. Note that >> this >> + * function may return 'token' or 'other' directly rather than allocating >> + * anything new. >> * >> * Caution: Only very cursory error-checking is performed to see if >> * the final result is a valid single token. */ >> static token_t * >> -_token_paste(glcpp_parser_t *parser, token_t *token, token_t *other) >> +_token_paste(glcpp_parser_t *parser, token_list_t *list, token_t *token, >> + token_t *other) > > > I seem to be blind... where is list used?
It's probably a leftover from my initial work where each list was a linear parent, but then I reworked it to use only one linear parent per parser instance. Marek _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev