star-enclosures-2d

Extract enclosures from 2D geometry
git clone git://git.meso-star.fr/star-enclosures-2d.git
Log | Files | Refs | README | LICENSE

commit e549288a9cf508096ae610aaa89fa321cb82382e
parent c0df844ca137b63389ad55f940bb3602c09f9af8
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Fri,  3 Jul 2020 18:01:10 +0200

Add lib name before func name in log messages

Diffstat:
Msrc/senc2d_internal_types.h | 10++++++----
Msrc/senc2d_scene.c | 11++++++-----
Msrc/senc2d_scene_analyze.c | 13++++++++-----
3 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/src/senc2d_internal_types.h b/src/senc2d_internal_types.h @@ -24,6 +24,8 @@ #include <stdint.h> /* Utility macros */ +#define LIB_NAME "star-enclosures-2d" + #ifdef NDEBUG #define OK2(Expr)\ if((tmp_res = (Expr)) != RES_OK) goto tmp_error; @@ -33,15 +35,15 @@ #else #define OK2(Expr)\ if((tmp_res = (Expr)) != RES_OK) {\ - fprintf(stderr, "%s: error code set to %d at line %d\n", FUNC_NAME,\ - tmp_res, __LINE__);\ + fprintf(stderr, LIB_NAME":%s: error code set to %d at line %d\n", \ + FUNC_NAME, tmp_res, __LINE__);\ goto tmp_error;\ } #define OK(Expr)\ if((res = (Expr)) != RES_OK) {\ - fprintf(stderr, "%s: error code set to %d at line %d\n", FUNC_NAME,\ - res, __LINE__);\ + fprintf(stderr, LIB_NAME":%s: error code set to %d at line %d\n", \ + FUNC_NAME, res, __LINE__);\ goto error;\ } #endif diff --git a/src/senc2d_scene.c b/src/senc2d_scene.c @@ -89,7 +89,8 @@ senc2d_scene_create scn = MEM_CALLOC(dev->allocator, 1, sizeof(struct senc2d_scene)); if(!scn) { - log_err(dev, "%s: could not allocate the star-enclosures-2d scene.\n", FUNC_NAME); + log_err(dev, LIB_NAME":%s: could not allocate the star-enclosures-2d scene.\n", + FUNC_NAME); res = RES_MEM_ERR; goto error; } @@ -128,7 +129,7 @@ senc2d_scene_create p_vrtx = htable_vrtx_find(&unique_vertices, &tmp); if(p_vrtx) { /* Duplicate vertex */ - log_err(scn->dev, "%s: vertex "PRTF_VRTX" is a duplicate.\n", + log_err(scn->dev, LIB_NAME":%s: vertex "PRTF_VRTX" is a duplicate.\n", FUNC_NAME, nv); res = RES_BAD_ARG; goto error; @@ -152,7 +153,7 @@ senc2d_scene_create FOR_EACH(j, 0, 2) { if(ind[j] >= nverts) { log_err(scn->dev, - "%s: segment "PRTF_SEG" uses invalid vertex id "PRTF_VRTX".\n", + LIB_NAME":%s: segment "PRTF_SEG" uses invalid vertex id "PRTF_VRTX".\n", FUNC_NAME, ns, ind[j]); res = RES_BAD_ARG; goto error; @@ -161,7 +162,7 @@ senc2d_scene_create tmp.vertice_id[j] = ind[j]; } if(tmp.vertice_id[0] == tmp.vertice_id[1]) { - log_err(scn->dev, "%s: segment "PRTF_SEG" is degenerated.\n", + log_err(scn->dev, LIB_NAME":%s: segment "PRTF_SEG" is degenerated.\n", FUNC_NAME, ns); res = RES_BAD_ARG; goto error; @@ -180,7 +181,7 @@ senc2d_scene_create p_seg = htable_seg_find(&unique_segments, &seg_key); if(p_seg) { /* Duplicate segment */ - log_err(scn->dev, "%s: segment "PRTF_SEG" is a duplicate.\n", + log_err(scn->dev, LIB_NAME":%s: segment "PRTF_SEG" is a duplicate.\n", FUNC_NAME, ns); res = RES_BAD_ARG; goto error; diff --git a/src/senc2d_scene_analyze.c b/src/senc2d_scene_analyze.c @@ -895,7 +895,7 @@ collect_and_link_neighbours previous = darray_neighbour_cdata_get(neighbourhood) + i - 1; prev_id = previous->seg_id; log_err(scn->dev, - "%s: found 2 overlying segments ("PRTF_SEG" & "PRTF_SEG").\n", + LIB_NAME":%s: found 2 overlying segments ("PRTF_SEG" & "PRTF_SEG").\n", FUNC_NAME, crt_id, prev_id); tmp_res = RES_BAD_OP; goto tmp_error; @@ -1267,7 +1267,8 @@ scene_analyze { if(res != RES_OK) { log_err(scn->dev, - "%s: could not build neighbourhoods from scene.\n", FUNC_NAME); + LIB_NAME":%s: could not build neighbourhoods from scene.\n", + FUNC_NAME); } else { res = res2; } @@ -1289,7 +1290,8 @@ scene_analyze #pragma omp single nowait { log_err(scn->dev, - "%s: could not extract connex components from scene.\n", FUNC_NAME); + LIB_NAME":%s: could not extract connex components from scene.\n", + FUNC_NAME); } /* No barrier here */ goto error_; } @@ -1312,7 +1314,8 @@ scene_analyze #pragma omp single nowait { log_err(scn->dev, - "%s: could not group connex components from scene.\n", FUNC_NAME); + LIB_NAME":%s: could not group connex components from scene.\n", + FUNC_NAME); } goto error_; } @@ -1342,7 +1345,7 @@ scene_analyze if(res != RES_OK) { #pragma omp single nowait { - log_err(scn->dev, "%s: could not build result.\n", FUNC_NAME); + log_err(scn->dev, LIB_NAME":%s: could not build result.\n", FUNC_NAME); } goto error_; }