diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-03 20:37:23 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-03 20:37:23 +0400 |
commit | 4770848871c9b19caf113f250a0346b4954a8c2e (patch) | |
tree | e61129948234f91acb31bc0f50b16ba552a34307 /source/blender/bmesh/intern/bmesh_structure.c | |
parent | 31761f5e5b06a394a4165ddc2eca27e644b1282a (diff) |
code cleanup: bmesh use 'const' for query functions.
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_structure.c')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_structure.c | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/source/blender/bmesh/intern/bmesh_structure.c b/source/blender/bmesh/intern/bmesh_structure.c index 2e060a4edf5..286425cbacf 100644 --- a/source/blender/bmesh/intern/bmesh_structure.c +++ b/source/blender/bmesh/intern/bmesh_structure.c @@ -45,7 +45,7 @@ bool bmesh_vert_in_edge(const BMEdge *e, const BMVert *v) if (e->v1 == v || e->v2 == v) return true; return false; } -bool bmesh_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e) +bool bmesh_verts_in_edge(const BMVert *v1, const BMVert *v2, const BMEdge *e) { if (e->v1 == v1 && e->v2 == v2) return true; else if (e->v1 == v2 && e->v2 == v1) return true; @@ -216,7 +216,7 @@ void bmesh_disk_edge_remove(BMEdge *e, BMVert *v) * * \return Pointer to the next edge in the disk cycle for the vertex v. */ -BMEdge *bmesh_disk_edge_next(BMEdge *e, BMVert *v) +BMEdge *bmesh_disk_edge_next(const BMEdge *e, const BMVert *v) { if (v == e->v1) return e->v1_disk_link.next; @@ -225,7 +225,7 @@ BMEdge *bmesh_disk_edge_next(BMEdge *e, BMVert *v) return NULL; } -BMEdge *bmesh_disk_edge_prev(BMEdge *e, BMVert *v) +BMEdge *bmesh_disk_edge_prev(const BMEdge *e, const BMVert *v) { if (v == e->v1) return e->v1_disk_link.prev; @@ -234,7 +234,7 @@ BMEdge *bmesh_disk_edge_prev(BMEdge *e, BMVert *v) return NULL; } -BMEdge *bmesh_disk_edge_exists(BMVert *v1, BMVert *v2) +BMEdge *bmesh_disk_edge_exists(const BMVert *v1, const BMVert *v2) { BMEdge *e_iter, *e_first; @@ -251,7 +251,7 @@ BMEdge *bmesh_disk_edge_exists(BMVert *v1, BMVert *v2) return NULL; } -int bmesh_disk_count(BMVert *v) +int bmesh_disk_count(const BMVert *v) { if (v->e) { BMEdge *e_first, *e_iter; @@ -304,7 +304,7 @@ bool bmesh_disk_validate(int len, BMEdge *e, BMVert *v) * equivalent to counting the number of * faces incident upon this vertex */ -int bmesh_disk_facevert_count(BMVert *v) +int bmesh_disk_facevert_count(const BMVert *v) { /* is there an edge on this vert at all */ if (v->e) { @@ -333,29 +333,28 @@ int bmesh_disk_facevert_count(BMVert *v) * vert's loops attached * to it. */ -BMEdge *bmesh_disk_faceedge_find_first(BMEdge *e, BMVert *v) +BMEdge *bmesh_disk_faceedge_find_first(const BMEdge *e, const BMVert *v) { - BMEdge *searchedge = NULL; - searchedge = e; + const BMEdge *e_find = e; do { - if (searchedge->l && bmesh_radial_facevert_count(searchedge->l, v)) { - return searchedge; + if (e_find->l && bmesh_radial_facevert_count(e_find->l, v)) { + return (BMEdge *)e_find; } - } while ((searchedge = bmesh_disk_edge_next(searchedge, v)) != e); + } while ((e_find = bmesh_disk_edge_next(e_find, v)) != e); return NULL; } -BMEdge *bmesh_disk_faceedge_find_next(BMEdge *e, BMVert *v) +BMEdge *bmesh_disk_faceedge_find_next(const BMEdge *e, const BMVert *v) { - BMEdge *searchedge = NULL; - searchedge = bmesh_disk_edge_next(e, v); + BMEdge *e_find = NULL; + e_find = bmesh_disk_edge_next(e, v); do { - if (searchedge->l && bmesh_radial_facevert_count(searchedge->l, v)) { - return searchedge; + if (e_find->l && bmesh_radial_facevert_count(e_find->l, v)) { + return e_find; } - } while ((searchedge = bmesh_disk_edge_next(searchedge, v)) != e); - return e; + } while ((e_find = bmesh_disk_edge_next(e_find, v)) != e); + return (BMEdge *)e; } /*****radial cycle functions, e.g. loops surrounding edges**** */ @@ -435,19 +434,19 @@ void bmesh_radial_loop_remove(BMLoop *l, BMEdge *e) * Finds the first loop of v around radial * cycle */ -BMLoop *bmesh_radial_faceloop_find_first(BMLoop *l, BMVert *v) +BMLoop *bmesh_radial_faceloop_find_first(const BMLoop *l, const BMVert *v) { - BMLoop *l_iter; + const BMLoop *l_iter; l_iter = l; do { if (l_iter->v == v) { - return l_iter; + return (BMLoop *)l_iter; } } while ((l_iter = l_iter->radial_next) != l); return NULL; } -BMLoop *bmesh_radial_faceloop_find_next(BMLoop *l, BMVert *v) +BMLoop *bmesh_radial_faceloop_find_next(const BMLoop *l, const BMVert *v) { BMLoop *l_iter; l_iter = l->radial_next; @@ -456,12 +455,12 @@ BMLoop *bmesh_radial_faceloop_find_next(BMLoop *l, BMVert *v) return l_iter; } } while ((l_iter = l_iter->radial_next) != l); - return l; + return (BMLoop *)l; } -int bmesh_radial_length(BMLoop *l) +int bmesh_radial_length(const BMLoop *l) { - BMLoop *l_iter = l; + const BMLoop *l_iter = l; int i = 0; if (!l) @@ -514,9 +513,9 @@ void bmesh_radial_append(BMEdge *e, BMLoop *l) * Returns the number of times a vertex appears * in a radial cycle */ -int bmesh_radial_facevert_count(BMLoop *l, BMVert *v) +int bmesh_radial_facevert_count(const BMLoop *l, const BMVert *v) { - BMLoop *l_iter; + const BMLoop *l_iter; int count = 0; l_iter = l; do { |