From 85b0315b3bae9e699021977f9b40d504d9a9d108 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 17 Aug 2013 08:00:22 +0000 Subject: avoid double ghash lookups --- source/blender/editors/sculpt_paint/sculpt_uv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/sculpt_paint/sculpt_uv.c') diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 9c73d4d9477..d630b6478fb 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -662,6 +662,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { int offset1, itmp1 = uv_element_offset_from_face_get(data->elementMap, efa, l, island_index, do_island_optimization); int offset2, itmp2 = uv_element_offset_from_face_get(data->elementMap, efa, l->next, island_index, do_island_optimization); + char *flag; /* Skip edge if not found(unlikely) or not on valid island */ if (itmp1 == -1 || itmp2 == -1) @@ -682,8 +683,8 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm edges[counter].uv2 = offset1; } /* Hack! Set the value of the key to its flag. Now we can set the flag when an edge exists twice :) */ - if (BLI_ghash_haskey(edgeHash, &edges[counter])) { - char *flag = BLI_ghash_lookup(edgeHash, &edges[counter]); + flag = BLI_ghash_lookup(edgeHash, &edges[counter]); + if (flag) { *flag = 1; } else { -- cgit v1.2.3