[Bf-blender-cvs] [9015cba5ceb] master: Cleanup: clang-tidy uv_parametrizer.cc
Campbell Barton
noreply at git.blender.org
Thu Aug 11 03:04:03 CEST 2022
Commit: 9015cba5ceb6cd1e8403160b55472276f60d979a
Author: Campbell Barton
Date: Thu Aug 11 11:03:23 2022 +1000
Branches: master
https://developer.blender.org/rB9015cba5ceb6cd1e8403160b55472276f60d979a
Cleanup: clang-tidy uv_parametrizer.cc
===================================================================
M source/blender/geometry/intern/uv_parametrizer.cc
===================================================================
diff --git a/source/blender/geometry/intern/uv_parametrizer.cc b/source/blender/geometry/intern/uv_parametrizer.cc
index ab2cca5d71e..b7526d82ecc 100644
--- a/source/blender/geometry/intern/uv_parametrizer.cc
+++ b/source/blender/geometry/intern/uv_parametrizer.cc
@@ -234,7 +234,7 @@ static void phash_insert(PHash *ph, PHashLink *link)
uintptr_t hash = PHASH_hash(ph, link->key);
PHashLink *lookup = ph->buckets[hash];
- if (lookup == NULL) {
+ if (lookup == nullptr) {
/* insert in front of the list */
ph->buckets[hash] = link;
link->next = *(ph->list);
@@ -249,13 +249,13 @@ static void phash_insert(PHash *ph, PHashLink *link)
ph->size++;
if (ph->size > (size * 3)) {
- PHashLink *next = NULL, *first = *(ph->list);
+ PHashLink *next = nullptr, *first = *(ph->list);
ph->cursize = PHashSizes[++ph->cursize_id];
MEM_freeN(ph->buckets);
ph->buckets = (PHashLink **)MEM_callocN(ph->cursize * sizeof(*ph->buckets), "PHashBuckets");
ph->size = 0;
- *(ph->list) = NULL;
+ *(ph->list) = nullptr;
for (link = first; link; link = next) {
next = link->next;
@@ -274,7 +274,7 @@ static PHashLink *phash_lookup(PHash *ph, PHashKey key)
return link;
}
if (PHASH_hash(ph, link->key) != hash) {
- return NULL;
+ return nullptr;
}
}
@@ -290,7 +290,7 @@ static PHashLink *phash_next(PHash *ph, PHashKey key, PHashLink *link)
return link;
}
if (PHASH_hash(ph, link->key) != hash) {
- return NULL;
+ return nullptr;
}
}
@@ -456,7 +456,7 @@ static PEdge *p_wheel_edge_next(PEdge *e)
static PEdge *p_wheel_edge_prev(PEdge *e)
{
- return (e->pair) ? e->pair->next : NULL;
+ return (e->pair) ? e->pair->next : nullptr;
}
static PEdge *p_boundary_edge_next(PEdge *e)
@@ -694,7 +694,7 @@ static PEdge *p_edge_lookup(ParamHandle *handle, const PHashKey *vkeys)
e = (PEdge *)phash_next(handle->hash_edges, key, (PHashLink *)e);
}
- return NULL;
+ return nullptr;
}
static int p_face_exists(ParamHandle *handle, const ParamKey *pvkeys, int i1, int i2, int i3)
@@ -769,7 +769,7 @@ static bool p_edge_has_pair(ParamHandle *handle, PEdge *e, bool topology_from_uv
key = PHASH_edge(key1, key2);
pe = (PEdge *)phash_lookup(handle->hash_edges, key);
- *r_pair = NULL;
+ *r_pair = nullptr;
while (pe) {
if (pe != e) {
@@ -782,7 +782,7 @@ static bool p_edge_has_pair(ParamHandle *handle, PEdge *e, bool topology_from_uv
/* don't connect seams and t-junctions */
if ((pe->flag & PEDGE_SEAM) || *r_pair ||
(topology_from_uvs && p_edge_implicit_seam(e, pe))) {
- *r_pair = NULL;
+ *r_pair = nullptr;
return false;
}
@@ -796,12 +796,12 @@ static bool p_edge_has_pair(ParamHandle *handle, PEdge *e, bool topology_from_uv
if (*r_pair && (e->vert == (*r_pair)->vert)) {
if ((*r_pair)->next->pair || (*r_pair)->next->next->pair) {
/* non unfoldable, maybe mobius ring or klein bottle */
- *r_pair = NULL;
+ *r_pair = nullptr;
return false;
}
}
- return (*r_pair != NULL);
+ return (*r_pair != nullptr);
}
static bool p_edge_connect_pair(ParamHandle *handle,
@@ -809,7 +809,7 @@ static bool p_edge_connect_pair(ParamHandle *handle,
bool topology_from_uvs,
PEdge ***stack)
{
- PEdge *pair = NULL;
+ PEdge *pair = nullptr;
if (!e->pair && p_edge_has_pair(handle, e, topology_from_uvs, &pair)) {
if (e->vert == pair->vert) {
@@ -825,7 +825,7 @@ static bool p_edge_connect_pair(ParamHandle *handle,
}
}
- return (e->pair != NULL);
+ return (e->pair != nullptr);
}
static int p_connect_pairs(ParamHandle *handle, bool topology_from_uvs)
@@ -880,7 +880,7 @@ static int p_connect_pairs(ParamHandle *handle, bool topology_from_uvs)
static void p_split_vert(ParamHandle *handle, PChart *chart, PEdge *e)
{
- PEdge *we, *lastwe = NULL;
+ PEdge *we, *lastwe = nullptr;
PVert *v = e->vert;
bool copy = true;
@@ -993,9 +993,9 @@ static PFace *p_face_add(ParamHandle *handle)
e2->next = e3;
e3->next = e1;
- e1->pair = NULL;
- e2->pair = NULL;
- e3->pair = NULL;
+ e1->pair = nullptr;
+ e2->pair = nullptr;
+ e3->pair = nullptr;
e1->flag = 0;
e2->flag = 0;
@@ -1073,7 +1073,7 @@ static PFace *p_face_add_fill(ParamHandle *handle, PChart *chart, PVert *v1, PVe
e2->vert = v2;
e3->vert = v3;
- e1->orig_uv = e2->orig_uv = e3->orig_uv = NULL;
+ e1->orig_uv = e2->orig_uv = e3->orig_uv = nullptr;
f->nextlink = chart->faces;
chart->faces = f;
@@ -1125,7 +1125,7 @@ static void p_chart_boundaries(PChart *chart, PEdge **r_outer)
chart->nboundaries = 0;
if (r_outer) {
- *r_outer = NULL;
+ *r_outer = nullptr;
}
for (e = chart->edges; e; e = e->nextlink) {
@@ -1216,7 +1216,7 @@ static void p_chart_fill_boundary(ParamHandle *handle, PChart *chart, PEdge *be,
BLI_heap_remove(heap, e1->u.heaplink);
BLI_heap_remove(heap, e2->u.heaplink);
- e->u.heaplink = e1->u.heaplink = e2->u.heaplink = NULL;
+ e->u.heaplink = e1->u.heaplink = e2->u.heaplink = nullptr;
e->flag |= PEDGE_FILLED;
e1->flag |= PEDGE_FILLED;
@@ -1254,7 +1254,7 @@ static void p_chart_fill_boundary(ParamHandle *handle, PChart *chart, PEdge *be,
}
}
- BLI_heap_free(heap, NULL);
+ BLI_heap_free(heap, nullptr);
}
static void p_chart_fill_boundaries(ParamHandle *handle, PChart *chart, PEdge *outer)
@@ -1537,7 +1537,7 @@ static void p_vert_harmonic_insert(PVert *v)
e = p_wheel_edge_next(e);
} while (e && (e != v->edge));
- if (e == NULL) {
+ if (e == nullptr) {
npoints++;
}
@@ -1551,7 +1551,7 @@ static void p_vert_harmonic_insert(PVert *v)
points[i][0] = e->next->vert->uv[0];
points[i][1] = e->next->vert->uv[1];
- if (nexte == NULL) {
+ if (nexte == nullptr) {
i++;
points[i][0] = e->next->next->vert->uv[0];
points[i][1] = e->next->next->vert->uv[1];
@@ -1895,8 +1895,8 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair)
int nshapeold = 0, nshapenew = 0;
p_collapsing_verts(edge, pair, &oldv, &keepv);
- oldf1 = (edge) ? edge->face : NULL;
- oldf2 = (pair) ? pair->face : NULL;
+ oldf1 = (edge) ? edge->face : nullptr;
+ oldf2 = (pair) ? pair->face : nullptr;
sub_v3_v3v3(edgevec, keepv->co, oldv->co);
@@ -1917,7 +1917,7 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair)
# if 0
shapecost += dot_v3v3(co1, keepv->co);
- if (p_wheel_edge_next(e) == NULL) {
+ if (p_wheel_edge_next(e) == nullptr) {
shapecost += dot_v3v3(co2, keepv->co);
}
# endif
@@ -1970,14 +1970,14 @@ static void p_collapse_cost_vertex(PVert *vert, float *r_mincost, PEdge **r_mine
{
PEdge *e, *enext, *pair;
- *r_mine = NULL;
+ *r_mine = nullptr;
*r_mincost = 0.0f;
e = vert->edge;
do {
if (p_collapse_allowed(e, e->pair)) {
float cost = p_collapse_cost(e, e->pair);
- if ((*r_mine == NULL) || (cost < *r_mincost)) {
+ if ((*r_mine == nullptr) || (cost < *r_mincost)) {
*r_mincost = cost;
*r_mine = e;
}
@@ -1985,14 +1985,14 @@ static void p_collapse_cost_vertex(PVert *vert, float *r_mincost, PEdge **r_mine
enext = p_wheel_edge_next(e);
- if (enext == NULL) {
+ if (enext == nullptr) {
/* The other boundary edge, where we only have the pair half-edge. */
pair = e->next->next;
- if (p_collapse_allowed(NULL, pair)) {
- float cost = p_collapse_cost(NULL, pair);
+ if (p_collapse_allowed(nullptr, pair)) {
+ float cost = p_collapse_cost(nullptr, pair);
- if ((*r_mine == NULL) || (cost < *r_mincost)) {
+ if ((*r_mine == nullptr) || (cost < *r_mincost)) {
*r_mincost = cost;
*r_mine = pair;
}
@@ -2009,13 +2009,13 @@ static void p_chart_post_collapse_flush(PChart *chart, PEdge *collapsed)
{
/* Move to `collapsed_*`. */
- PVert *v, *nextv = NULL, *verts = chart->verts;
- PEdge *e, *nexte = NULL, *edges = chart->edges, *laste = NULL;
- PFace *f, *nextf = NULL, *faces = chart->faces;
+ PVert *v, *nextv = nullptr, *verts = chart->verts;
+ PEdge *e, *nexte = nullptr, *edges = chart->edges, *laste = nullptr;
+ PFace *f, *nextf = nullptr, *faces = chart->faces;
- chart->verts = chart->collapsed_verts = NULL;
- chart->edges = chart->collapsed_edges = NULL;
- chart->faces = chart->collapsed_faces = NULL;
+ chart->verts = chart->collapsed_verts = nullptr;
+ chart->edges = chart->collapsed_edges = nullptr;
+ chart->faces = chart->collapsed_faces = nullptr;
chart->nverts = chart->nedges = chart->nfaces = 0;
@@ -2079,9 +2079,9 @@ static void p_chart_post_split_flush(PChart *chart)
{
/* Move from `collapsed_*`. */
- PVert *v, *nextv = NULL;
- PEdge *e, *nexte = NULL;
- PFace *f, *nextf = NULL;
+ PVert *v, *nextv = nullptr;
+ PEdge *e, *nexte = nullptr;
+ PFace *f, *nextf = nullptr;
for (v = chart->collapsed_verts; v; v = nextv) {
nextv = v->nextlink;
@@ -2104,9 +2104,9 @@ static void p_chart_post_split_flush(PChart *chart)
chart->nfaces++;
}
- chart->collapsed_verts = NULL;
- chart->collapsed_edges = NULL;
- chart->collapsed_faces = NULL;
+ chart->collapsed_verts = nullptr;
+ chart->collapsed_edges = nullptr;
+ chart->collapsed_faces = nullptr;
}
static void p_chart_simplify_compute(PChart *chart)
@@ -2118,7 +2118,7 @@ static void p_chart_simplify_compute(PChart *chart)
Heap *heap = BLI_heap_new();
PVert *v, **wheelverts;
- PEdge *collapsededges = NULL, *e;
+ PEdge *collapsededges = nullptr, *e;
int nwheelverts, i, ncollapsed = 0;
wheelverts = MEM_mallocN(sizeof(PVert *) * chart->nverts, "PChartWheelVerts");
@@ -2126,7 +2126,7 @@ static void p_chart_simplify_compute(PChart *chart)
/* insert all potential collapses into heap */
for (v = chart->verts; v; v = v->nextlink) {
float cost;
- PEdge *e = NULL;
+ PEdge *e = nullptr;
p_collapse_cost_vertex(v, &cost, &e);
@@ -2134,12 +2134,12 @@ static void p_chart_simplify_compute(PChart *chart)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list