diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-02-26 18:57:41 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-02-26 18:57:41 +0400 |
commit | 62f9959a8e4269293ee80c3bfe3f55e8b12f7ccd (patch) | |
tree | c14c0c9430c2c6755b6bc07a818348c35868ae6f /source/blender/bmesh/intern | |
parent | ed21afa2eb84bd944667b0f89cdc325ccd9d58f5 (diff) |
replace bmesh_error with macro that gives the file/line/func the error happens on.
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh.c | 8 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mods.c | 8 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_newcore.c | 56 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_structure.c | 14 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_walkers.c | 2 |
5 files changed, 45 insertions, 43 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index 097c87ca1c6..7d8e55347f5 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -51,14 +51,16 @@ int bm_mesh_allocsize_default[4] = {512, 512, 2048, 512}; /* bmesh_error stub */ -void bmesh_error(void) +void _bmesh_error(const char *at, const char *func) { - printf("BM modelling error!\n"); + fprintf(stderr, "BM modelling error '%s', func '%s'!\n", at, func); +#ifdef WITH_ASSERT_ABORT /* This placeholder assert makes modelling errors easier to catch * in the debugger, until bmesh_error is replaced with something * better. */ - BLI_assert(0); + abort(); +#endif } static void bmesh_mempool_init(BMesh *bm, const int allocsize[4]) diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index d32f516f26e..2816c3e4910 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -268,14 +268,14 @@ BMFace *BM_faces_join_pair(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e) } if (!jed) { - bmesh_error(); + BMESH_ERROR; return NULL; } l1 = jed->l; if (!l1) { - bmesh_error(); + BMESH_ERROR; return NULL; } @@ -616,7 +616,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **ne, float percen l = e1->l; if (!l) { - bmesh_error(); + BMESH_ERROR; break; } @@ -647,7 +647,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **ne, float percen l = e1->l; if (!l) { - bmesh_error(); + BMESH_ERROR; break; } diff --git a/source/blender/bmesh/intern/bmesh_newcore.c b/source/blender/bmesh/intern/bmesh_newcore.c index a03e1512557..dbb44f2cbc3 100644 --- a/source/blender/bmesh/intern/bmesh_newcore.c +++ b/source/blender/bmesh/intern/bmesh_newcore.c @@ -452,7 +452,7 @@ int bmesh_check_element(BMesh *UNUSED(bm), void *element, const char htype) } if (err) { - bmesh_error(); + BMESH_ERROR; } return err; @@ -792,14 +792,14 @@ static int count_flagged_radial(BMesh *bm, BMLoop *l, int flag) do { if (!l2) { - bmesh_error(); + BMESH_ERROR; goto error; } i += BM_ELEM_API_FLAG_TEST(l2->f, flag) ? 1 : 0; l2 = bmesh_radial_nextloop(l2); if (c >= BM_LOOP_RADIAL_MAX) { - bmesh_error(); + BMESH_ERROR; goto error; } c++; @@ -891,7 +891,7 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface) int i, tote = 0; if (!totface) { - bmesh_error(); + BMESH_ERROR; return NULL; } @@ -1288,11 +1288,11 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **re) /* verify disk cycle */ edok = bmesh_disk_validate(valence1, ov->e, ov); - if (!edok) bmesh_error(); + if (!edok) BMESH_ERROR; edok = bmesh_disk_validate(valence2, tv->e, tv); - if (!edok) bmesh_error(); + if (!edok) BMESH_ERROR; edok = bmesh_disk_validate(2, nv->e, nv); - if (!edok) bmesh_error(); + if (!edok) BMESH_ERROR; /* Split the radial cycle if presen */ nextl = e->l; @@ -1358,21 +1358,21 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **re) /* verify length of radial cycl */ edok = bmesh_radial_validate(radlen, e->l); - if (!edok) bmesh_error(); + if (!edok) BMESH_ERROR; edok = bmesh_radial_validate(radlen, ne->l); - if (!edok) bmesh_error(); + if (!edok) BMESH_ERROR; /* verify loop->v and loop->next->v pointers for */ for (i = 0, l = e->l; i < radlen; i++, l = l->radial_next) { - if (!(l->e == e)) bmesh_error(); - //if (!(l->radial_next == l)) bmesh_error(); + if (!(l->e == e)) BMESH_ERROR; + //if (!(l->radial_next == l)) BMESH_ERROR; if (l->prev->e != ne && l->next->e != ne) { - bmesh_error(); + BMESH_ERROR; } edok = bmesh_verts_in_edge(l->v, l->next->v, e); - if (!edok) bmesh_error(); - if (l->v == l->next->v) bmesh_error(); - if (l->e == l->next->e) bmesh_error(); + if (!edok) BMESH_ERROR; + if (l->v == l->next->v) BMESH_ERROR; + if (l->e == l->next->e) BMESH_ERROR; /* verify loop cycle for kloop-> */ BM_CHECK_ELEMENT(bm, l); @@ -1382,13 +1382,13 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **re) } /* verify loop->v and loop->next->v pointers for n */ for (i = 0, l = ne->l; i < radlen; i++, l = l->radial_next) { - if (!(l->e == ne)) bmesh_error(); - //if (!(l->radial_next == l)) bmesh_error(); - if (l->prev->e != e && l->next->e != e) bmesh_error(); + if (!(l->e == ne)) BMESH_ERROR; + //if (!(l->radial_next == l)) BMESH_ERROR; + if (l->prev->e != e && l->next->e != e) BMESH_ERROR; edok = bmesh_verts_in_edge(l->v, l->next->v, ne); - if (!edok) bmesh_error(); - if (l->v == l->next->v) bmesh_error(); - if (l->e == l->next->e) bmesh_error(); + if (!edok) BMESH_ERROR; + if (l->v == l->next->v) BMESH_ERROR; + if (l->e == l->next->e) BMESH_ERROR; BM_CHECK_ELEMENT(bm, l); BM_CHECK_ELEMENT(bm, l->v); @@ -1525,7 +1525,7 @@ struct BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_e /* Validate radial cycle of o */ edok = bmesh_radial_validate(radlen, oe->l); if (!edok) { - bmesh_error(); + BMESH_ERROR; } } @@ -1537,17 +1537,17 @@ struct BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_e /* Validate disk cycle lengths of ov, tv are unchange */ edok = bmesh_disk_validate(valence1, ov->e, ov); - if (!edok) bmesh_error(); + if (!edok) BMESH_ERROR; edok = bmesh_disk_validate(valence2, tv->e, tv); - if (!edok) bmesh_error(); + if (!edok) BMESH_ERROR; /* Validate loop cycle of all faces attached to o */ for (i = 0, l = oe->l; i < radlen; i++, l = bmesh_radial_nextloop(l)) { - if (l->e != oe) bmesh_error(); + if (l->e != oe) BMESH_ERROR; edok = bmesh_verts_in_edge(l->v, l->next->v, oe); - if (!edok) bmesh_error(); + if (!edok) BMESH_ERROR; edok = bmesh_loop_validate(l->f); - if (!edok) bmesh_error(); + if (!edok) BMESH_ERROR; BM_CHECK_ELEMENT(bm, l); BM_CHECK_ELEMENT(bm, l->v); @@ -1723,7 +1723,7 @@ BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e) /* validate the new loop cycle */ edok = bmesh_loop_validate(f1); - if (!edok) bmesh_error(); + if (!edok) BMESH_ERROR; return f1; } diff --git a/source/blender/bmesh/intern/bmesh_structure.c b/source/blender/bmesh/intern/bmesh_structure.c index 8b16c641c3a..a90208540b9 100644 --- a/source/blender/bmesh/intern/bmesh_structure.c +++ b/source/blender/bmesh/intern/bmesh_structure.c @@ -366,7 +366,7 @@ int bmesh_radial_validate(int radlen, BMLoop *l) do { if (!l_iter) { - bmesh_error(); + BMESH_ERROR; return FALSE; } @@ -376,7 +376,7 @@ int bmesh_radial_validate(int radlen, BMLoop *l) return FALSE; if (i > BM_LOOP_RADIAL_MAX) { - bmesh_error(); + BMESH_ERROR; return FALSE; } @@ -398,7 +398,7 @@ void bmesh_radial_remove_loop(BMLoop *l, BMEdge *e) { /* if e is non-NULL, l must be in the radial cycle of e */ if (e && e != l->e) { - bmesh_error(); + BMESH_ERROR; } if (l->radial_next != l) { @@ -414,7 +414,7 @@ void bmesh_radial_remove_loop(BMLoop *l, BMEdge *e) e->l = NULL; } else { - bmesh_error(); + BMESH_ERROR; } } } @@ -472,13 +472,13 @@ int bmesh_radial_length(BMLoop *l) do { if (!l_iter) { /* radial cycle is broken (not a circulat loop) */ - bmesh_error(); + BMESH_ERROR; return 0; } i++; if (i >= BM_LOOP_RADIAL_MAX) { - bmesh_error(); + BMESH_ERROR; return -1; } } while ((l_iter = l_iter->radial_next) != l); @@ -504,7 +504,7 @@ void bmesh_radial_append(BMEdge *e, BMLoop *l) if (l->e && l->e != e) { /* l is already in a radial cycle for a different edge */ - bmesh_error(); + BMESH_ERROR; } l->e = e; diff --git a/source/blender/bmesh/intern/bmesh_walkers.c b/source/blender/bmesh/intern/bmesh_walkers.c index 9cba90c1bf5..4fe54bfaa01 100644 --- a/source/blender/bmesh/intern/bmesh_walkers.c +++ b/source/blender/bmesh/intern/bmesh_walkers.c @@ -89,7 +89,7 @@ void BMW_init(BMWalker *walker, BMesh *bm, int type, walker->visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers 1"); if (type >= BMW_MAXWALKERS || type < 0) { - bmesh_error(); + BMESH_ERROR; fprintf(stderr, "Invalid walker type in BMW_init; type: %d, " "searchmask: (v:%d, e:%d, l:%d, f:%d), flag: %d\n", |