Module: Mesa Branch: main Commit: 6d4eb4a72e90aa80460ce282133befc589b6ee72 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d4eb4a72e90aa80460ce282133befc589b6ee72
Author: Dylan Baker <[email protected]> Date: Thu Feb 10 14:59:05 2022 -0800 mesa/main: replace use of simple_list with util/list Because really, do we want simple_list? Reviewed-by: Emma Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14983> --- src/mesa/main/shaderapi.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index b94297e56b3..abf2c458887 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -62,7 +62,7 @@ #include "util/hash_table.h" #include "util/crc32.h" #include "util/os_file.h" -#include "util/simple_list.h" +#include "util/list.h" #include "util/u_process.h" #include "util/u_string.h" #include "api_exec_decl.h" @@ -3235,8 +3235,7 @@ _mesa_GetProgramStageiv(GLuint program, GLenum shadertype, */ struct sh_incl_path_entry { - struct sh_incl_path_entry *next; - struct sh_incl_path_entry *prev; + struct list_head list; char *path; }; @@ -3353,8 +3352,8 @@ validate_and_tokenise_sh_incl(struct gl_context *ctx, char *path_str = strtok_r(full_path, "/", &save_ptr); *path_list = rzalloc(mem_ctx, struct sh_incl_path_entry); - - make_empty_list(*path_list); + struct sh_incl_path_entry * list = *path_list; + list_inithead(&list->list); while (path_str != NULL) { if (strlen(path_str) == 0) { @@ -3369,14 +3368,13 @@ validate_and_tokenise_sh_incl(struct gl_context *ctx, if (strcmp(path_str, ".") == 0) { /* Do nothing */ } else if (strcmp(path_str, "..") == 0) { - struct sh_incl_path_entry *last = last_elem(*path_list); - remove_from_list(last); + list_del(list->list.prev); } else { struct sh_incl_path_entry *path = rzalloc(mem_ctx, struct sh_incl_path_entry); path->path = strdup(path_str); - insert_at_tail(*path_list, path); + list_addtail(&path->list, &list->list); } path_str = strtok_r(NULL, "/", &save_ptr); @@ -3416,7 +3414,7 @@ next_relative_path: { struct sh_incl_path_entry *rel_path_list = ctx->Shared->ShaderIncludes->include_paths[i]; - foreach(entry, rel_path_list) { + LIST_FOR_EACH_ENTRY(entry, &rel_path_list->list, list) { struct hash_entry *ht_entry = _mesa_hash_table_search(path_ht, entry->path); @@ -3445,7 +3443,7 @@ next_relative_path: } } - foreach(entry, path_list) { + LIST_FOR_EACH_ENTRY(entry, &path_list->list, list) { struct hash_entry *ht_entry = _mesa_hash_table_search(path_ht, entry->path); @@ -3553,7 +3551,7 @@ _mesa_NamedStringARB(GLenum type, GLint namelen, const GLchar *name, ctx->Shared->ShaderIncludes->shader_include_tree; struct sh_incl_path_entry *entry; - foreach(entry, path_list) { + LIST_FOR_EACH_ENTRY(entry, &path_list->list, list) { struct hash_entry *ht_entry = _mesa_hash_table_search(path_ht, entry->path); @@ -3570,7 +3568,7 @@ _mesa_NamedStringARB(GLenum type, GLint namelen, const GLchar *name, path_ht = sh_incl_ht_entry->path; - if (last_elem(path_list) == entry) { + if (list_last_entry(&path_list->list, struct sh_incl_path_entry, list) == entry) { free(sh_incl_ht_entry->shader_source); sh_incl_ht_entry->shader_source = string_cp; }
