[postgis-tickets] r14963 - Add LWDEBUGG macro in lwgeom_log.h
Sandro Santilli
strk at kbt.io
Thu Jun 16 03:45:13 PDT 2016
Author: strk
Date: 2016-06-16 03:45:12 -0700 (Thu, 16 Jun 2016)
New Revision: 14963
Modified:
trunk/liblwgeom/lwgeom_log.h
trunk/liblwgeom/lwgeom_topo.c
Log:
Add LWDEBUGG macro in lwgeom_log.h
Modified: trunk/liblwgeom/lwgeom_log.h
===================================================================
--- trunk/liblwgeom/lwgeom_log.h 2016-06-16 09:18:36 UTC (rev 14962)
+++ trunk/liblwgeom/lwgeom_log.h 2016-06-16 10:45:12 UTC (rev 14963)
@@ -52,6 +52,18 @@
__FILE__, __func__, __LINE__, __VA_ARGS__); \
} while (0);
+/* Display a notice and a WKT representation of a geometry
+ * at the given debug level */
+#define LWDEBUGG(level, geom, msg) \
+ if (POSTGIS_DEBUG_LEVEL >= level) \
+ do { \
+ size_t sz; \
+ char *wkt = lwgeom_to_wkt(geom, WKT_EXTENDED, 15, &sz); \
+ /* char *wkt = lwgeom_to_hexwkb(geom, WKT_EXTENDED, &sz); */ \
+ LWDEBUGF(level, msg ": %s", wkt); \
+ lwfree(wkt); \
+ } while (0);
+
#else /* POSTGIS_DEBUG_LEVEL <= 0 */
/* Empty prototype that can be optimised away by the compiler
@@ -64,6 +76,11 @@
#define LWDEBUGF(level, msg, ...) \
((void) 0)
+/* Empty prototype that can be optimised away by the compiler
+ * for non-debug builds */
+#define LWDEBUGG(level, geom, msg) \
+ ((void) 0)
+
#endif /* POSTGIS_DEBUG_LEVEL <= 0 */
/**
Modified: trunk/liblwgeom/lwgeom_topo.c
===================================================================
--- trunk/liblwgeom/lwgeom_topo.c 2016-06-16 09:18:36 UTC (rev 14962)
+++ trunk/liblwgeom/lwgeom_topo.c 2016-06-16 10:45:12 UTC (rev 14963)
@@ -44,18 +44,6 @@
# define LWTFMT_ELEMID PRId64
#endif
-/* TODO: move this to lwgeom_log.h */
-#define LWDEBUGG(level, geom, msg) \
- if (POSTGIS_DEBUG_LEVEL >= level) \
- do { \
- size_t sz; \
- char *wkt1 = lwgeom_to_wkt(geom, WKT_EXTENDED, 15, &sz); \
- /* char *wkt1 = lwgeom_to_hexwkb(geom, WKT_EXTENDED, &sz); */ \
- LWDEBUGF(level, msg ": %s", wkt1); \
- lwfree(wkt1); \
- } while (0);
-
-
/*********************************************************************
*
* Backend iface
More information about the postgis-tickets
mailing list