From: espen Date: Wed, 8 Oct 2008 18:11:12 +0000 (+0000) Subject: Use glib's API for memory allocation X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/clg/commitdiff_plain/a666b391b604d3afe86079e064e648d9062430ef?ds=sidebyside Use glib's API for memory allocation --- diff --git a/glib/glib.lisp b/glib/glib.lisp index 220002e..43eb8bc 100644 --- a/glib/glib.lisp +++ b/glib/glib.lisp @@ -20,7 +20,7 @@ ;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -;; $Id: glib.lisp,v 1.43 2008-04-01 21:17:59 espen Exp $ +;; $Id: glib.lisp,v 1.44 2008-10-08 18:11:12 espen Exp $ (in-package "GLIB") @@ -39,24 +39,20 @@ (defmacro with-mutex ((mutex) &body body) ;;;; Memory management -(defbinding (%allocate-memory "g_malloc0") () pointer - (size unsigned-long)) +(deftype gsize () 'unsigned-int) -(defbinding (%deallocate-memory "g_free") () nil - (address pointer)) +(defbinding malloc0 () pointer + (size gsize)) -;; (setf -;; (symbol-function 'allocate-memory) #'%allocate-memory -;; (symbol-function 'deallocate-memory) #'%deallocate-memory) +(defbinding free () nil + (address pointer)) -(setf *memory-allocator* #'%allocate-memory) -(setf *memory-deallocator* #'%deallocate-memory) +(setf *memory-allocator* #'malloc0) +(setf *memory-deallocator* #'free) (defbinding (reallocate-memory "g_realloc") () pointer (address pointer) - (size unsigned-long)) - -(deftype gsize () 'unsigned-int) + (size gsize)) (defbinding (slice-alloc "g_slice_alloc0") () pointer (block-size gsize))