[geos-commits] r2509 - in branches/3.1: . capi

svn_geos at osgeo.org svn_geos at osgeo.org
Wed May 13 08:35:01 EDT 2009


Author: warmerdam
Date: 2009-05-13 08:35:00 -0400 (Wed, 13 May 2009)
New Revision: 2509

Modified:
   branches/3.1/ChangeLog
   branches/3.1/capi/geos_c.cpp
   branches/3.1/capi/geos_c.h.in
   branches/3.1/capi/geos_ts_c.cpp
Log:
added GEOSFree() and GEOSFree_r() (#249)

Modified: branches/3.1/ChangeLog
===================================================================
--- branches/3.1/ChangeLog	2009-05-13 11:29:55 UTC (rev 2508)
+++ branches/3.1/ChangeLog	2009-05-13 12:35:00 UTC (rev 2509)
@@ -1,3 +1,8 @@
+2009-05-13  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* capi/geos_ts_c.cpp, capi/geos_c.cpp, capi/geos_c.h.in: Added
+	GEOSFree() and GEOSFree_r() functions (#249).
+
 2009-02-07 23:29  pramsey
 
 	* source/headers/geos/precision/Makefile.am: Include

Modified: branches/3.1/capi/geos_c.cpp
===================================================================
--- branches/3.1/capi/geos_c.cpp	2009-05-13 11:29:55 UTC (rev 2508)
+++ branches/3.1/capi/geos_c.cpp	2009-05-13 12:35:00 UTC (rev 2509)
@@ -85,6 +85,12 @@
     finishGEOS_r( handle );
 }
 
+void 
+GEOSFree (void* buffer) 
+{ 
+    GEOSFree_r( handle, buffer ); 
+} 
+    
 /****************************************************************
 ** relate()-related functions
 ** return 0 = false, 1 = true, 2 = error occured

Modified: branches/3.1/capi/geos_c.h.in
===================================================================
--- branches/3.1/capi/geos_c.h.in	2009-05-13 11:29:55 UTC (rev 2508)
+++ branches/3.1/capi/geos_c.h.in	2009-05-13 12:35:00 UTC (rev 2509)
@@ -21,9 +21,8 @@
  *	  functions, and call finishGEOS() when done.
  *
  *	- Currently you have to explicitly GEOSGeom_destroy() all
- *	  GEOSGeom objects to avoid memory leaks, and to free()
- *	  all returned char * (unless const). This might change
- *	  before first release to ensure greater API stability.
+ *	  GEOSGeom objects to avoid memory leaks, and to GEOSFree()
+ *	  all returned char * (unless const). 
  *
  ***********************************************************************/
 
@@ -820,6 +819,12 @@
                                    GEOSWKBWriter* writer, const char writeSRID);
 
 
+/*
+ * Free buffers returned by stuff like GEOSWKBWriter_write(), 
+ * GEOSWKBWriter_writeHEX() and GEOSWKTWriter_write(). 
+ */
+extern void GEOS_DLL GEOSFree( void *buffer );
+extern void GEOS_DLL GEOSFree_r( GEOSContextHandle_t handle, void *buffer );
 
 #ifdef __cplusplus
 } // extern "C"

Modified: branches/3.1/capi/geos_ts_c.cpp
===================================================================
--- branches/3.1/capi/geos_ts_c.cpp	2009-05-13 11:29:55 UTC (rev 2508)
+++ branches/3.1/capi/geos_ts_c.cpp	2009-05-13 12:35:00 UTC (rev 2509)
@@ -152,6 +152,12 @@
     extHandle = NULL;
 }
 
+void 
+GEOSFree_r (GEOSContextHandle_t extHandle, void* buffer) 
+{ 
+    std::free(buffer); 
+} 
+
 //-----------------------------------------------------------
 // relate()-related functions
 //  return 0 = false, 1 = true, 2 = error occured



More information about the geos-commits mailing list