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

Michael Fuhr mike at fuhr.org
Sat Feb 4 11:17:48 PST 2006


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
-------------- next part --------------
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"
  


More information about the postgis-users mailing list