Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-07-10 05:04:29 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-07-10 05:14:32 +0300
commit8f24ec2e26ac634789ed9027dcfe6d1cd14782a7 (patch)
tree8afa02cf0343626f9eee3781629557709aca6ae3 /source/blender/editors/uvedit
parent3dd460aa7fbb7021130b58f7809cfda5b69df201 (diff)
Cleanup: add BLI_linklist_find_last
This makes adding to the end of a linked list simpler, In most cases we avoid this in favor of BLI_linklist_append. For one off operations it's OK.
Diffstat (limited to 'source/blender/editors/uvedit')
-rw-r--r--source/blender/editors/uvedit/uvedit_path.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/uvedit/uvedit_path.c b/source/blender/editors/uvedit/uvedit_path.c
index 3a7badc3e7b..8476592b587 100644
--- a/source/blender/editors/uvedit/uvedit_path.c
+++ b/source/blender/editors/uvedit/uvedit_path.c
@@ -265,10 +265,10 @@ static void mouse_mesh_uv_shortest_path_vert(Scene *scene,
if (path) {
if ((l_dst_add_to_path != NULL) && (BLI_linklist_index(path, l_dst_add_to_path) == -1)) {
- /* Weak, we could find the last and append after that. */
- BLI_linklist_reverse(&path);
- BLI_linklist_prepend(&path, l_dst_add_to_path);
- BLI_linklist_reverse(&path);
+ /* Append, this isn't optimal compared to #BLI_linklist_append, it's a one-off lookup. */
+ LinkNode *path_last = BLI_linklist_find_last(path);
+ BLI_linklist_insert_after(&path_last, l_dst_add_to_path);
+ BLI_assert(BLI_linklist_find_last(path)->link == l_dst_add_to_path);
}
/* toggle the flag */