From f2b5bf3767e006ef22c7d838c548b049f332a8f7 Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Fri, 26 Feb 2016 11:19:07 +0000 Subject: [PATCH] Expunge all trace of rt_init_allocators git-svn-id: http://svn.osgeo.org/postgis/trunk@14704 b70326c6-7e19-0410-871a-916f4a2858ee --- raster/loader/raster2pgsql.c | 3 ++- raster/rt_core/librtcore.h | 20 ++------------------ raster/rt_core/rt_context.c | 5 ++--- raster/rt_pg/rtpostgis.c | 9 --------- raster/test/cunit/cu_misc.c | 2 +- raster/test/cunit/cu_tester.c | 19 +++++++++---------- 6 files changed, 16 insertions(+), 42 deletions(-) diff --git a/raster/loader/raster2pgsql.c b/raster/loader/raster2pgsql.c index da3b35b1f..2d7828b03 100644 --- a/raster/loader/raster2pgsql.c +++ b/raster/loader/raster2pgsql.c @@ -60,7 +60,8 @@ loader_rt_info_handler(const char *fmt, va_list ap) { va_end(ap); } -void rt_init_allocators(void) { +static void +rt_init_allocators(void) { rt_set_handlers( default_rt_allocator, default_rt_reallocator, diff --git a/raster/rt_core/librtcore.h b/raster/rt_core/librtcore.h index 52bc829b3..2001a9238 100644 --- a/raster/rt_core/librtcore.h +++ b/raster/rt_core/librtcore.h @@ -40,9 +40,8 @@ * of non-PostGIS applications using rt_core. * * Programs using this library should set up the default memory managers and error - * handlers by implementing an rt_init_allocators() function, which can be as - * a wrapper around the rt_install_default_allocators() function if you want - * no special handling for memory management and error reporting. + * handlers by calling rt_set_handlers() function, or rt_install_default_allocators() + * if you want no special handling for memory management and error reporting. * **/ @@ -245,27 +244,12 @@ typedef void (*rt_deallocator)(void *mem); typedef void (*rt_message_handler)(const char* string, va_list ap) __attribute__ (( format(printf,1,0) )); -/**************************************************************************** - * Functions that must be implemented for the raster core function's caller - * (for example: rt_pg functions, test functions, future loader/exporter) - ****************************************************************************/ - -/** - * Supply the memory management and error handling functions you want your - * application to use - */ -extern void rt_init_allocators(void); - -/*********************************************************************/ - - /******************************************************************* * Functions that may be used by the raster core function's caller * (for example: rt_pg functions, test functions, future loader/exporter) *******************************************************************/ /** * Apply the default memory management (malloc() and free()) and error handlers. - * Called inside rt_init_allocators() generally. */ extern void rt_install_default_allocators(void); diff --git a/raster/rt_core/rt_context.c b/raster/rt_core/rt_context.c index 104d3021e..dce892b4e 100644 --- a/raster/rt_core/rt_context.c +++ b/raster/rt_core/rt_context.c @@ -126,8 +126,7 @@ static struct rt_context_t ctx_t = { /** - * This function is normally called by rt_init_allocators when no special memory - * management is needed. Useful in raster core testing and in the (future) + * Useful in raster core testing and in the (future) * loader, when we need to use raster core functions but we don't have * PostgreSQL backend behind. We must take care of memory by ourselves in those * situations @@ -145,7 +144,7 @@ rt_install_default_allocators(void) /** - * This function is called by rt_init_allocators when the PostgreSQL backend is + * This function is called when the PostgreSQL backend is * taking care of the memory and we want to use palloc family */ void diff --git a/raster/rt_pg/rtpostgis.c b/raster/rt_pg/rtpostgis.c index ffad1e1aa..c506b82fd 100644 --- a/raster/rt_pg/rtpostgis.c +++ b/raster/rt_pg/rtpostgis.c @@ -236,15 +236,6 @@ rt_pg_debug(const char *fmt, va_list ap) } -void -rt_init_allocators(void) -{ - /* raster callback - install raster handlers */ - rt_set_handlers(rt_pg_alloc, rt_pg_realloc, rt_pg_free, rt_pg_error, - rt_pg_debug, rt_pg_notice); -} - - /* ---------------------------------------------------------------- */ /* PostGIS raster GUCs */ /* ---------------------------------------------------------------- */ diff --git a/raster/test/cunit/cu_misc.c b/raster/test/cunit/cu_misc.c index 55790729d..0616e2645 100644 --- a/raster/test/cunit/cu_misc.c +++ b/raster/test/cunit/cu_misc.c @@ -115,7 +115,7 @@ static void test_util_gdal_open() { char *disable_all = GDAL_DISABLE_ALL; char *enabled = "GTiff JPEG PNG"; - char *enabled_vsi = "GTiff JPEG PNG VSICURL"; + // char *enabled_vsi = "GTiff JPEG PNG VSICURL"; rt_util_gdal_register_all(1); diff --git a/raster/test/cunit/cu_tester.c b/raster/test/cunit/cu_tester.c index 670b5150e..d50c4b39c 100644 --- a/raster/test/cunit/cu_tester.c +++ b/raster/test/cunit/cu_tester.c @@ -72,6 +72,15 @@ int main(int argc, char *argv[]) /* install the custom error handler */ lwgeom_set_handlers(0, 0, 0, cu_error_reporter, 0); + rt_set_handlers( + default_rt_allocator, + default_rt_reallocator, + default_rt_deallocator, + cu_error_reporter, + default_rt_info_handler, + default_rt_warning_handler + ); + /* initialize the CUnit test registry */ if (CUE_SUCCESS != CU_initialize_registry()) { @@ -240,13 +249,3 @@ rt_band cu_add_band(rt_raster raster, rt_pixtype pixtype, int hasnodata, double return band; } -void rt_init_allocators(void) { - rt_set_handlers( - default_rt_allocator, - default_rt_reallocator, - default_rt_deallocator, - cu_error_reporter, - default_rt_info_handler, - default_rt_warning_handler - ); -} -- 2.40.0