[postgis-tickets] r14694 - Change from on-the-fly raster context set-up to _PG_init()-driven context set-up, hopefully to address upgrade issues on ubuntu

Paul Ramsey pramsey at cleverelephant.ca
Thu Feb 25 02:08:04 PST 2016


Author: pramsey
Date: 2016-02-25 02:08:04 -0800 (Thu, 25 Feb 2016)
New Revision: 14694

Modified:
   trunk/raster/loader/raster2pgsql.c
   trunk/raster/rt_core/rt_context.c
   trunk/raster/rt_pg/rtpostgis.c
Log:
Change from on-the-fly raster context set-up to _PG_init()-driven context set-up, hopefully to address upgrade issues on ubuntu


Modified: trunk/raster/loader/raster2pgsql.c
===================================================================
--- trunk/raster/loader/raster2pgsql.c	2016-02-25 09:08:09 UTC (rev 14693)
+++ trunk/raster/loader/raster2pgsql.c	2016-02-25 10:08:04 UTC (rev 14694)
@@ -2279,6 +2279,8 @@
 	GDALDriverH drv = NULL;
 	char *tmp = NULL;
 
+	rt_init_allocators();
+	
 #ifdef USE_NLS
 	setlocale (LC_ALL, "");
 	bindtextdomain (PACKAGE, LOCALEDIR);

Modified: trunk/raster/rt_core/rt_context.c
===================================================================
--- trunk/raster/rt_core/rt_context.c	2016-02-25 09:08:09 UTC (rev 14693)
+++ trunk/raster/rt_core/rt_context.c	2016-02-25 10:08:04 UTC (rev 14694)
@@ -36,14 +36,6 @@
 * rt_context
 ******************************************************************************/
 
-/* Functions definitions */
-void * init_rt_allocator(size_t size);
-void * init_rt_reallocator(void * mem, size_t size);
-void init_rt_deallocator(void * mem);
-void init_rt_errorreporter(const char * fmt, va_list ap);
-void init_rt_warnreporter(const char * fmt, va_list ap);
-void init_rt_inforeporter(const char * fmt, va_list ap);
-
 /*
  * Default allocators
  *
@@ -124,12 +116,12 @@
 
 /* Static variable, to be used for all rt_core functions */
 static struct rt_context_t ctx_t = {
-    .alloc = init_rt_allocator,
-    .realloc = init_rt_reallocator,
-    .dealloc = init_rt_deallocator,
-    .err = init_rt_errorreporter,
-    .warn = init_rt_warnreporter,
-    .info = init_rt_inforeporter
+    .alloc = default_rt_allocator,
+    .realloc = default_rt_reallocator,
+    .dealloc = default_rt_deallocator,
+    .err = default_rt_error_handler,
+    .warn = default_rt_warning_handler,
+    .info = default_rt_info_handler
 };
 
 
@@ -170,67 +162,7 @@
     ctx_t.warn = warning_handler;
 }
 
-/**
- * Initialisation allocators
- *
- * These are used the first time any of the allocators are called to enable
- * executables/libraries that link into raster to be able to set up their own
- * allocators. This is mainly useful for older PostgreSQL versions that don't
- * have functions that are called upon startup.
- **/
-void *
-init_rt_allocator(size_t size)
-{
-    rt_init_allocators();
 
-    return ctx_t.alloc(size);
-}
-
-void
-init_rt_deallocator(void *mem)
-{
-    rt_init_allocators();
-
-    ctx_t.dealloc(mem);
-}
-
-
-void *
-init_rt_reallocator(void *mem, size_t size)
-{
-    rt_init_allocators();
-
-    return ctx_t.realloc(mem, size);
-}
-
-void
-init_rt_inforeporter(const char *fmt, va_list ap)
-{
-    rt_init_allocators();
-
-    (*ctx_t.info)(fmt, ap);
-}
-
-void
-init_rt_warnreporter(const char *fmt, va_list ap)
-{
-    rt_init_allocators();
-
-    (*ctx_t.warn)(fmt, ap);
-}
-
-
-void
-init_rt_errorreporter(const char *fmt, va_list ap)
-{
-    rt_init_allocators();
-
-    (*ctx_t.err)(fmt, ap);
-
-}
-
-
-
 /**
  * Raster core memory management functions.
  *

Modified: trunk/raster/rt_pg/rtpostgis.c
===================================================================
--- trunk/raster/rt_pg/rtpostgis.c	2016-02-25 09:08:09 UTC (rev 14693)
+++ trunk/raster/rt_pg/rtpostgis.c	2016-02-25 10:08:04 UTC (rev 14694)
@@ -381,10 +381,10 @@
 	/* Install liblwgeom handlers */
 	pg_install_lwgeom_handlers();
 
-	/* TODO: Install raster callbacks (see rt_init_allocators)??? */
+	/* Install rtcore handlers */
+	rt_init_allocators();
 
 	/* Define custom GUC variables. */
-
 	if ( postgis_guc_find_option("postgis.gdal_datapath") )
 	{
 		/* In this narrow case the previously installed GUC is tied to the callback in */



More information about the postgis-tickets mailing list