mirror of
https://git.osgeo.org/gitea/postgis/postgis
synced 2024-10-23 16:42:35 +00:00
Change from on-the-fly raster context set-up to _PG_init()-driven context set-up, hopefully to address upgrade issues on ubuntu
git-svn-id: http://svn.osgeo.org/postgis/trunk@14694 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
parent
befd771bb8
commit
b214b12a98
|
@ -2279,6 +2279,8 @@ main(int argc, char **argv) {
|
|||
GDALDriverH drv = NULL;
|
||||
char *tmp = NULL;
|
||||
|
||||
rt_init_allocators();
|
||||
|
||||
#ifdef USE_NLS
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
|
|
|
@ -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 @@ struct rt_context_t {
|
|||
|
||||
/* 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,66 +162,6 @@ rt_set_handlers(rt_allocator allocator, rt_reallocator reallocator,
|
|||
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.
|
||||
|
|
|
@ -381,10 +381,10 @@ _PG_init(void) {
|
|||
/* 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 */
|
||||
|
|
Loading…
Reference in a new issue