From 951547118a6c4e0766beabf4d7b211e79b7db00d Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 19 Jun 2015 10:38:15 +0000 Subject: [PATCH] Add an lwpgwarning function, for those who worry ! git-svn-id: http://svn.osgeo.org/postgis/trunk@13683 b70326c6-7e19-0410-871a-916f4a2858ee --- libpgcommon/lwgeom_pg.c | 23 +++++++++++++++++++++++ libpgcommon/lwgeom_pg.h | 1 + 2 files changed, 24 insertions(+) diff --git a/libpgcommon/lwgeom_pg.c b/libpgcommon/lwgeom_pg.c index 5983af0e7f7..b989c3d3c5f 100644 --- a/libpgcommon/lwgeom_pg.c +++ b/libpgcommon/lwgeom_pg.c @@ -162,6 +162,17 @@ pg_error(const char *fmt, va_list ap) ereport(ERROR, (errmsg_internal("%s", errmsg))); } +static void +pg_warning(const char *fmt, va_list ap) +{ + char errmsg[PGC_ERRMSG_MAXLEN+1]; + + vsnprintf (errmsg, PGC_ERRMSG_MAXLEN, fmt, ap); + + errmsg[PGC_ERRMSG_MAXLEN]='\0'; + ereport(WARNING, (errmsg_internal("%s", errmsg))); +} + static void pg_notice(const char *fmt, va_list ap) { @@ -245,6 +256,18 @@ lwpgnotice(const char *fmt, ...) va_end(ap); } +void +lwpgwarning(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + + pg_warning(fmt, ap); + + va_end(ap); +} + void lwpgerror(const char *fmt, ...) { diff --git a/libpgcommon/lwgeom_pg.h b/libpgcommon/lwgeom_pg.h index 789e2deb3f0..d5a4d173ef0 100644 --- a/libpgcommon/lwgeom_pg.h +++ b/libpgcommon/lwgeom_pg.h @@ -172,5 +172,6 @@ Datum LWGEOM_dropBBOX(PG_FUNCTION_ARGS); void lwpgerror(const char *fmt, ...); void lwpgnotice(const char *fmt, ...); +void lwpgwarning(const char *fmt, ...); #endif /* !defined _LWGEOM_PG_H */