From 44fbe97aa619ba387b39279921e43e2294a44963 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Wed, 23 Nov 2016 07:34:29 +0000 Subject: [PATCH] Reorganize code to make comments have more sense git-svn-id: http://svn.osgeo.org/postgis/trunk@15244 b70326c6-7e19-0410-871a-916f4a2858ee --- liblwgeom/lwutil.c | 98 +++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/liblwgeom/lwutil.c b/liblwgeom/lwutil.c index 282986bfa..804cf34f1 100644 --- a/liblwgeom/lwutil.c +++ b/liblwgeom/lwutil.c @@ -77,53 +77,6 @@ static char *lwgeomTypeName[] = "Tin" }; -/* - * Default lwnotice/lwerror handlers - * - * Since variadic functions cannot pass their parameters directly, we need - * wrappers for these functions to convert the arguments into a va_list - * structure. - */ - -void -lwnotice(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - - /* Call the supplied function */ - (*lwnotice_var)(fmt, ap); - - va_end(ap); -} - -void -lwerror(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - - /* Call the supplied function */ - (*lwerror_var)(fmt, ap); - - va_end(ap); -} - -void -lwdebug(int level, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - - /* Call the supplied function */ - (*lwdebug_var)(level, fmt, ap); - - va_end(ap); -} - /* * Default allocators * @@ -152,6 +105,14 @@ default_reallocator(void *mem, size_t size) return ret; } +/* + * Default lwnotice/lwerror handlers + * + * Since variadic functions cannot pass their parameters directly, we need + * wrappers for these functions to convert the arguments into a va_list + * structure. + */ + static void default_noticereporter(const char *fmt, va_list ap) { @@ -212,6 +173,47 @@ lwgeom_set_debuglogger(lwdebuglogger debuglogger) { if ( debuglogger ) lwdebug_var = debuglogger; } +void +lwnotice(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + + /* Call the supplied function */ + (*lwnotice_var)(fmt, ap); + + va_end(ap); +} + +void +lwerror(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + + /* Call the supplied function */ + (*lwerror_var)(fmt, ap); + + va_end(ap); +} + +void +lwdebug(int level, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + + /* Call the supplied function */ + (*lwdebug_var)(level, fmt, ap); + + va_end(ap); +} + + + const char* lwtype_name(uint8_t type) { @@ -391,7 +393,7 @@ clamp_srid(int srid) ( srid % ( SRID_MAXIMUM - SRID_USER_MAXIMUM - 1 ) ); lwnotice("SRID value %d > SRID_MAXIMUM converted to %d", srid, newsrid); } - + return newsrid; } -- 2.50.1