Changeset 1008

Show
Ignore:
Timestamp:
01/04/08 11:13:19
Author:
seang
Message:

Free GEOS allocated memory in wkb and wkt dumpers, increment version number

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Shapely/trunk/manual/manual.txt

    r1007 r1008  
    1010:date: 2 January 2008 
    1111 
    12 :copyright: This work is licensed under a `Creative Commons Attribution-Share Alike 3.0 United States License`__. 
    13  
    14 .. __: http://creativecommons.org/licenses/by-sa/3.0/us/ 
     12:copyright: This work is licensed under a `Creative Commons Attribution 3.0 United States License`__. 
     13 
     14.. __: http://creativecommons.org/licenses/by/3.0/us/ 
    1515 
    1616:abstract: This document describes the Shapely Python package for programming with geospatial geometries. 
  • Shapely/trunk/setup.py

    r985 r1008  
    1212 
    1313setup(name          = 'Shapely', 
    14       version       = '1.0b3', 
     14      version       = '1.0b4', 
    1515      description   = 'Geospatial geometries, predicates, and operations', 
    1616      license       = 'BSD', 
  • Shapely/trunk/shapely/wkb.py

    r750 r1008  
    55from ctypes import byref, c_int, c_size_t, c_char_p, string_at 
    66 
    7 from shapely.geos import lgeos, ReadingError 
     7from shapely.geos import lgeos, free, ReadingError 
    88from shapely.geometry.base import geom_factory 
    99 
     
    2626def dumps(ob): 
    2727    """Dump a WKB representation of a geometry to a byte string.""" 
     28    func = lgeos.GEOSGeomToWKB_buf 
    2829    size = c_int() 
    29     bytes = lgeos.GEOSGeomToWKB_buf(ob._geom, byref(size)) 
    30     return string_at(bytes, size.value) 
     30    def errcheck(result, func, argtuple): 
     31        retval = string_at(result, size.value)[:] 
     32        free(result) 
     33        return retval 
     34    func.errcheck = errcheck 
     35    return func(ob._geom, byref(size)) 
    3136 
    3237def dump(ob, fp): 
  • Shapely/trunk/shapely/wkt.py

    r750 r1008  
    55from ctypes import byref, c_int, c_size_t, c_char_p, string_at 
    66 
    7 from shapely.geos import lgeos, ReadingError 
     7from shapely.geos import lgeos, free, allocated_c_char_p, ReadingError 
    88from shapely.geometry.base import geom_factory 
    99 
     
    2626def dumps(ob): 
    2727    """Dump a WKB representation of a geometry to a byte string.""" 
    28     return string_at(lgeos.GEOSGeomToWKT(ob._geom)) 
     28    func = lgeos.GEOSGeomToWKT 
     29    def errcheck(result, func, argtuple): 
     30        retval = result.value 
     31        free(result) 
     32        return retval 
     33    func.restype = allocated_c_char_p 
     34    func.errcheck = errcheck 
     35    return lgeos.GEOSGeomToWKT(ob._geom) 
    2936 
    3037def dump(ob, fp):