Commit da2f4c41 authored by Niels Möller's avatar Niels Möller
Browse files

(make-freer): Free elements of allocated

arrays, i.e. variables of type "space".

Rev: src/scm/gaba.scm:1.18
parent 4435aec6
...@@ -311,7 +311,21 @@ ...@@ -311,7 +311,21 @@
((struct) (c-call* (c-append (cadr type) "_free") (c-address expr))) ((struct) (c-call* (c-append (cadr type) "_free") (c-address expr)))
((string) (c-call* "lsh_string_free" expr)) ((string) (c-call* "lsh_string_free" expr))
((bignum) (c-call* "mpz_clear" expr)) ((bignum) (c-call* "mpz_clear" expr))
((space) (c-call* "lsh_space_free" expr)) ((space)
(let* ((free-space (c-call* "lsh_space_free" expr))
(counter (make-var))
(free-k (and (not (null? (cddr type)))
;; The optional argument should be the name
;; of an instance variable holding the length
;; of the area pointed to.
(make-freer (cadr type)
(c-append "(" expr ")[" counter "]")))))
(if free-k
(c-block* (c-declare `( ,counter simple unsigned))
(c-for counter (c-append "i->" (caddr type))
((special) (c-call* (cadddr type) expr)) ((special) (c-call* (cadddr type) expr))
((indirect-special) ((indirect-special)
(let ((free (cadddr type))) (let ((free (cadddr type)))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment