[postgis-users] PostGIS, 64 bit Solaris, Invalide memory alloc message using force_collection

strk at refractions.net strk at refractions.net
Mon Feb 6 03:18:07 PST 2006


Mike, I moved uint32_t typedef back from wktparse.h
to lwgparse.c and wktunparse.c.
We don't want to include postgres.h in the wk{t,b} parser.
The idea is that most of PostGIS should be able to run
stadalone, with postgresql interface being a wrapper.
This decoupling is not complete yet, and I dunno if
will ever be, but I prefer not introducing dependencies
making it harder.

There is a special 'test' rule under lwgeom you can
run to test the standalone library. It will link
against liblwgeom_sa.a. 'sa' stands for "stand alone".
You can see lwgeom/Makefile to find out which modules
*should* already be undependent of postgres:

SA_OBJS <-- postgresql independent

--strk;

On Sat, Feb 04, 2006 at 12:17:48PM -0700, Michael Fuhr wrote:
> On Sat, Feb 04, 2006 at 04:40:55AM +0100, strk at refractions.net wrote:
> > On Fri, Feb 03, 2006 at 07:08:50PM -0700, Michael Fuhr wrote:
> > > Is there a reason to use int4 at all instead of int32_t or uint32_t?
> > 
> > No reason, we can use uint32_t and forget about int4.
> > Thanks for the help, my head is about to blow up!
> 
> As I dug into the code I found a lot of uses of uint32 as well, so
> that raised another question: do you want to use both uint32 and
> uint32_t or do you want to standardize on one of them?  PostgreSQL
> appears to use uint32 exclusively; PostGIS could do the same by
> including postgres.h everywhere.  I started doing that but discovered
> that in several places PostGIS has its own typedef for uint32, so
> those would have to be removed to avoid "previous declaration"
> errors.  The patch was getting bigger and wider-reaching than
> strictly necessary and than I had intended, so I backed off and
> made the fewest number of changes that gets things working.  The
> attached patch is against HEAD; I've tested it with PostgreSQL 8.1.2
> on Solaris 9 sparc 64 bit, Solaris 9 sparc 32 bit, and FreeBSD 6.0
> i386 32 bit and all regression tests pass.
> 
> I'm thinking that whether to use int4 and/or uint32 and/or uint32_t
> and where to get the typedefs should be treated as a cleanup job,
> and that the discussion would be more appropriate in a separate
> thread on postgis-devel.
> 
> -- 
> Michael Fuhr

> Only in postgis11: configure
> diff -cr postgis11.ORIG/lwgeom/lwgparse.c postgis11/lwgeom/lwgparse.c
> *** postgis11.ORIG/lwgeom/lwgparse.c	Fri Feb  3 17:46:56 2006
> --- postgis11/lwgeom/lwgparse.c	Sat Feb  4 10:31:58 2006
> ***************
> *** 7,14 ****
>    */
>   #include <string.h>
>   #include <stdio.h>
> - #include <stdint.h>
>   
>   #include "liblwgeom.h"
>   #include "wktparse.h"
>   
> --- 7,14 ----
>    */
>   #include <string.h>
>   #include <stdio.h>
>   
> + #include "postgres.h"
>   #include "liblwgeom.h"
>   #include "wktparse.h"
>   
> diff -cr postgis11.ORIG/lwgeom/wktparse.h postgis11/lwgeom/wktparse.h
> *** postgis11.ORIG/lwgeom/wktparse.h	Fri Feb  3 17:46:56 2006
> --- postgis11/lwgeom/wktparse.h	Sat Feb  4 10:28:47 2006
> ***************
> *** 23,29 ****
>   typedef void  (*report_error)(const char* string, ...);
>   
>   /*typedef unsigned long int4;*/
> ! typedef uint32_t int4;
>   
>   
>   /* How much memory is allocated at a time(bytes) for tuples */
> --- 23,29 ----
>   typedef void  (*report_error)(const char* string, ...);
>   
>   /*typedef unsigned long int4;*/
> ! /*typedef uint32_t int4;*/
>   
>   
>   /* How much memory is allocated at a time(bytes) for tuples */
> diff -cr postgis11.ORIG/lwgeom/wktunparse.c postgis11/lwgeom/wktunparse.c
> *** postgis11.ORIG/lwgeom/wktunparse.c	Fri Feb  3 17:46:56 2006
> --- postgis11/lwgeom/wktunparse.c	Sat Feb  4 10:30:43 2006
> ***************
> *** 15,20 ****
> --- 15,21 ----
>   #include <sys/types.h>
>   #include <sys/param.h>
>   
> + #include "postgres.h"
>   #include "liblwgeom.h"
>   #include "wktparse.h"
>   

> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users


-- 

 +----------------------------------------+
 | Fight against software patents in EU!  |
 | www.ffii.org www.nosoftwarepatents.org |
 +----------------------------------------+




More information about the postgis-users mailing list