commit ccd59b607c25fbcf327197cfd51b3e916fbd74e0
parent 5a6be30faf321766ced4d2e12a89d979b707b324
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Thu, 11 Jun 2020 12:57:00 +0200
Add lib name before func name in log messages
Diffstat:
3 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/src/sg3d_device.h b/src/sg3d_device.h
@@ -18,7 +18,7 @@
#include <rsys/ref_count.h>
- /* Forward declaration of external opaque data types */
+/* Forward declaration of external opaque data types */
struct logger;
struct mem_allocator;
diff --git a/src/sg3d_geometry.c b/src/sg3d_geometry.c
@@ -300,7 +300,7 @@ sg3d_geometry_create
geom = MEM_CALLOC(dev->allocator, 1, sizeof(struct sg3d_geometry));
if(!geom) {
log_err(dev,
- "%s: could not allocate the sg3d.\n", FUNC_NAME);
+ LIB_NAME":%s: could not allocate the sg3d.\n", FUNC_NAME);
res = RES_MEM_ERR;
goto error;
}
@@ -467,7 +467,7 @@ sg3d_geometry_add
ERR(dege_trg(nt, ctx, &abort));
} else {
log_warn(geom->dev,
- "%s: triangle "PRTF_TRG" is degenerated (removed).\n",
+ LIB_NAME":%s: triangle "PRTF_TRG" is degenerated (removed).\n",
FUNC_NAME, nt);
}
if(abort) {
@@ -847,7 +847,7 @@ sg3d_geometry_dump_as_obj
{
if(geom && !geom->triangle_count_including_duplicates)
log_err(geom->dev,
- "%s: cannot dump empty geometries as OBJ\n",
+ LIB_NAME":%s: cannot dump empty geometries as OBJ\n",
FUNC_NAME);
res = RES_BAD_ARG;
goto error;
@@ -900,7 +900,7 @@ sg3d_geometry_dump_as_vtk
if(!geom || !stream || !geom->triangle_count_including_duplicates) {
if(geom && !geom->triangle_count_including_duplicates)
log_err(geom->dev,
- "%s: cannot dump empty geometries as VTK\n",
+ LIB_NAME":%s: cannot dump empty geometries as VTK\n",
FUNC_NAME);
res = RES_BAD_ARG;
goto error;
@@ -1014,11 +1014,11 @@ sg3d_geometry_dump_as_c_code
&& (geom->merge_conflict_count
|| geom->properties_conflict_count))
log_err(geom->dev,
- "%s: cannot dump geometries with conflict as C code\n",
+ LIB_NAME":%s: cannot dump geometries with conflict as C code\n",
FUNC_NAME);
if(geom && !geom->triangle_count_including_duplicates)
log_err(geom->dev,
- "%s: cannot dump empty geometries as C code\n",
+ LIB_NAME":%s: cannot dump empty geometries as C code\n",
FUNC_NAME);
res = RES_BAD_ARG;
goto error;
diff --git a/src/sg3d_misc.h b/src/sg3d_misc.h
@@ -18,10 +18,21 @@
#include <rsys/dynamic_array.h>
+#define LIB_NAME "star-geometry-3d"
+
+#ifdef NDEBUG
#define ERR(Expr) if((res = (Expr)) != RES_OK) goto error;
+#else
+#define ERR(Expr) \
+ if((res = (Expr)) != RES_OK) {\
+ fprintf(stderr, LIB_NAME":%s: error code set to %d at line %d\n",\
+ FUNC_NAME, res, __LINE__);\
+ goto error;\
+ }
+#endif
/* The following types must be defined accordingly with the types
- * used in sg3d.h */
+ * used in sg3d.h */
/* Trg IDs use the same type than Side IDs */
typedef unsigned trg_id_t;