[postgis-commits] svn - r3649 - spike/wktraster/rt_pg

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Thu Feb 5 14:58:47 PST 2009


Author: strk
Date: 2009-02-05 14:58:47 -0800 (Thu, 05 Feb 2009)
New Revision: 3649

Added:
   spike/wktraster/rt_pg/pgsql_compat.h
Modified:
   spike/wktraster/rt_pg/rt_pg.c
Log:
Add compatibility header to support postgres versions < 8.3

Added: spike/wktraster/rt_pg/pgsql_compat.h
===================================================================
--- spike/wktraster/rt_pg/pgsql_compat.h	2009-02-05 22:07:05 UTC (rev 3648)
+++ spike/wktraster/rt_pg/pgsql_compat.h	2009-02-05 22:58:47 UTC (rev 3649)
@@ -0,0 +1,18 @@
+#ifndef _PGSQL_COMPAT_H
+
+/* Make sure PG_NARGS is defined for older PostgreSQL versions */
+#ifndef PG_NARGS
+#define PG_NARGS() (fcinfo->nargs)
+#endif
+
+/* Define ARR_OVERHEAD_NONULLS for PostgreSQL < 8.2 */
+#if POSTGIS_PGSQL_VERSION < 82
+#define ARR_OVERHEAD_NONULLS(x) ARR_OVERHEAD((x))
+#endif
+
+/* PostgreSQL < 8.3 uses VARATT_SIZEP rather than SET_VARSIZE for varlena types */
+#if POSTGIS_PGSQL_VERSION < 83
+#define SET_VARSIZE(var, size)   VARATT_SIZEP(var) = size
+#endif
+
+#endif /* _PGSQL_COMPAT_H */

Modified: spike/wktraster/rt_pg/rt_pg.c
===================================================================
--- spike/wktraster/rt_pg/rt_pg.c	2009-02-05 22:07:05 UTC (rev 3648)
+++ spike/wktraster/rt_pg/rt_pg.c	2009-02-05 22:58:47 UTC (rev 3649)
@@ -27,16 +27,17 @@
 #include <errno.h>
 #include <assert.h>
 
-#include "postgres.h" /* for palloc */
-#include "access/gist.h"
-#include "access/itup.h"
-#include "fmgr.h"
-#include "utils/elog.h"
-#include "funcapi.h"
+#include <postgres.h> /* for palloc */
+#include <access/gist.h>
+#include <access/itup.h>
+#include <fmgr.h>
+#include <utils/elog.h>
+#include <funcapi.h>
 
 /*#include "lwgeom_pg.h"*/
 #include "liblwgeom.h"
 #include "rt_pg.h"
+#include "pgsql_compat.h"
 #include "rt_api.h"
 
 



More information about the postgis-commits mailing list