Typo.
[cl-gtk2.git] / glib / glib.string.lisp
1 (in-package :glib)
2
3 ;; A type that it almost like :string but uses g_malloc and g_free
4
5 (define-foreign-type g-string-type ()
6   ((free-from-foreign :initarg :fff :reader g-string-type-fff :initform nil)
7    (free-to-foreign :initarg :ftf :reader g-string-type-ftf :initform t))
8   (:actual-type :pointer))
9
10 (define-parse-method g-string (&key (free-from-foreign nil) (free-to-foreign t))
11   (make-instance 'g-string-type :fff free-from-foreign :ftf free-to-foreign))
12
13 (defmethod translate-to-foreign (value (type g-string-type))
14   (g-strdup value))
15
16 (defmethod translate-from-foreign (value (type g-string-type))
17   (prog1
18       (convert-from-foreign value '(:string :free-from-foreign nil))
19     (when (g-string-type-fff type)
20       (g-free value))))