[postgis-tickets] r14703 - Expunge all trace of rt_init_allocators

Paul Ramsey pramsey at cleverelephant.ca
Fri Feb 26 03:17:49 PST 2016


Author: pramsey
Date: 2016-02-26 03:17:49 -0800 (Fri, 26 Feb 2016)
New Revision: 14703

Modified:
   branches/2.2/raster/loader/raster2pgsql.c
   branches/2.2/raster/rt_core/librtcore.h
   branches/2.2/raster/rt_core/rt_context.c
   branches/2.2/raster/rt_pg/rtpostgis.c
   branches/2.2/raster/test/cunit/cu_tester.c
Log:
Expunge all trace of rt_init_allocators


Modified: branches/2.2/raster/loader/raster2pgsql.c
===================================================================
--- branches/2.2/raster/loader/raster2pgsql.c	2016-02-26 10:02:57 UTC (rev 14702)
+++ branches/2.2/raster/loader/raster2pgsql.c	2016-02-26 11:17:49 UTC (rev 14703)
@@ -60,7 +60,8 @@
 	va_end(ap);
 }
 
-void rt_init_allocators(void) {
+static void 
+rt_init_allocators(void) {
 	rt_set_handlers(
 		default_rt_allocator,
 		default_rt_reallocator,
@@ -2285,6 +2286,9 @@
 	textdomain (PACKAGE);
 #endif
 
+	/* Set up memory handling */
+	rt_init_allocators();
+
 	/* no args, show usage */
 	if (argc == 1) {
 		usage();

Modified: branches/2.2/raster/rt_core/librtcore.h
===================================================================
--- branches/2.2/raster/rt_core/librtcore.h	2016-02-26 10:02:57 UTC (rev 14702)
+++ branches/2.2/raster/rt_core/librtcore.h	2016-02-26 11:17:49 UTC (rev 14703)
@@ -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 the rt_install_default_allocators() 
+ * function if you want no special handling for memory management and error reporting.
  *
  **/
 
@@ -245,27 +244,12 @@
 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);
 

Modified: branches/2.2/raster/rt_core/rt_context.c
===================================================================
--- branches/2.2/raster/rt_core/rt_context.c	2016-02-26 10:02:57 UTC (rev 14702)
+++ branches/2.2/raster/rt_core/rt_context.c	2016-02-26 11:17:49 UTC (rev 14703)
@@ -126,8 +126,7 @@
 
 
 /**
- * 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 @@
 
 
 /**
- * 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

Modified: branches/2.2/raster/rt_pg/rtpostgis.c
===================================================================
--- branches/2.2/raster/rt_pg/rtpostgis.c	2016-02-26 10:02:57 UTC (rev 14702)
+++ branches/2.2/raster/rt_pg/rtpostgis.c	2016-02-26 11:17:49 UTC (rev 14703)
@@ -414,6 +414,12 @@
 	char *env_postgis_enable_outdb_rasters = NULL;
 	bool boot_postgis_enable_outdb_rasters = false;
 
+	/* Install liblwgeom handlers */
+	pg_install_lwgeom_handlers();
+
+	/* Install rtcore handlers */
+	rt_set_handlers(rt_pg_alloc, rt_pg_realloc, rt_pg_free, rt_pg_error, rt_pg_debug, rt_pg_notice);
+
 	/*
 	 use POSTGIS_GDAL_ENABLED_DRIVERS to set the bootValue
 	 of GUC postgis.gdal_enabled_drivers
@@ -461,14 +467,7 @@
 		boot_postgis_enable_outdb_rasters ? "TRUE" : "FALSE"
 	);
 
-	/* Install liblwgeom handlers */
-	pg_install_lwgeom_handlers();
-
-	/* Install rtcore handlers */
-	rt_set_handlers(rt_pg_alloc, rt_pg_realloc, rt_pg_free, rt_pg_error, rt_pg_debug, rt_pg_notice);
-
 	/* Define custom GUC variables. */
-
 	DefineCustomStringVariable(
 		"postgis.gdal_datapath", /* name */
 		"Path to GDAL data files.", /* short_desc */

Modified: branches/2.2/raster/test/cunit/cu_tester.c
===================================================================
--- branches/2.2/raster/test/cunit/cu_tester.c	2016-02-26 10:02:57 UTC (rev 14702)
+++ branches/2.2/raster/test/cunit/cu_tester.c	2016-02-26 11:17:49 UTC (rev 14703)
@@ -239,14 +239,3 @@
 
 	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
-	);
-}



More information about the postgis-tickets mailing list