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; }