commit b67720f2fa6264a6d810fed1c170c85bfabe2757
parent 54a68f31493571dbaac3b9561ad9c60daea218ca
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Tue, 26 May 2020 16:03:43 +0200
Add lib name before func name in log messages
Diffstat:
3 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/src/senc3d_internal_types.h b/src/senc3d_internal_types.h
@@ -24,6 +24,8 @@
#include <stdint.h>
/* Utility macros */
+#define LIB_NAME "star-enclosures-3d"
+
#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/senc3d_scene.c b/src/senc3d_scene.c
@@ -88,7 +88,8 @@ senc3d_scene_create
scn = MEM_CALLOC(dev->allocator, 1, sizeof(struct senc3d_scene));
if(!scn) {
- log_err(dev, "%s: could not allocate the star_enclosures-3d scene.\n", FUNC_NAME);
+ log_err(dev, LIB_NAME":%s: could not allocate the star_enclosures-3d scene.\n",
+ FUNC_NAME);
res = RES_MEM_ERR;
goto error;
}
@@ -128,7 +129,7 @@ senc3d_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 @@ senc3d_scene_create
FOR_EACH(j, 0, 3) {
if(ind[j] >= nverts) {
log_err(scn->dev,
- "%s: triangle "PRTF_TRG" uses invalid vertex id "PRTF_VRTX".\n",
+ LIB_NAME":%s: triangle "PRTF_TRG" uses invalid vertex id "PRTF_VRTX".\n",
FUNC_NAME, nt, ind[j]);
res = RES_BAD_ARG;
goto error;
@@ -164,7 +165,7 @@ senc3d_scene_create
|| tmp.vertice_id[0] == tmp.vertice_id[2]
|| tmp.vertice_id[1] == tmp.vertice_id[2])
{
- log_err(scn->dev, "%s: triangle "PRTF_TRG" is degenerated.\n",
+ log_err(scn->dev, LIB_NAME":%s: triangle "PRTF_TRG" is degenerated.\n",
FUNC_NAME, nt);
res = RES_BAD_ARG;
goto error;
@@ -183,7 +184,7 @@ senc3d_scene_create
p_trg = htable_trg_find(&unique_triangles, &trg_key);
if(p_trg) {
/* Duplicate triangle */
- log_err(scn->dev, "%s: triangle "PRTF_TRG" is a duplicate.\n",
+ log_err(scn->dev, LIB_NAME":%s: triangle "PRTF_TRG" is a duplicate.\n",
FUNC_NAME, nt);
res = RES_BAD_ARG;
goto error;
diff --git a/src/senc3d_scene_analyze.c b/src/senc3d_scene_analyze.c
@@ -954,7 +954,7 @@ collect_and_link_neighbours
previous = darray_neighbour_cdata_get(neighbour_list) + i - 1;
prev_id = previous->trg_id;
log_err(scn->dev,
- "%s: found 2 overlying triangles ("PRTF_TRG" & "PRTF_TRG").\n",
+ LIB_NAME":%s: found 2 overlying triangles ("PRTF_TRG" & "PRTF_TRG").\n",
FUNC_NAME, crt_id, prev_id);
tmp_res = RES_BAD_OP;
goto tmp_error;
@@ -1328,7 +1328,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;
}
@@ -1350,7 +1351,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_;
}
@@ -1373,7 +1375,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_;
}
@@ -1403,7 +1406,8 @@ 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_;
}