summaryrefslogtreecommitdiff
path: root/Lisp/type-conversion.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'Lisp/type-conversion.lisp')
-rw-r--r--Lisp/type-conversion.lisp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lisp/type-conversion.lisp b/Lisp/type-conversion.lisp
index 066fdd9..a11a668 100644
--- a/Lisp/type-conversion.lisp
+++ b/Lisp/type-conversion.lisp
@@ -56,3 +56,12 @@
,@(mapcar #'(lambda (name-value-pair)
`(dealloc-obj-data ,(first name-value-pair)))
bindings))))
+
+
+(defun foreign-string-to-lisp/dealloc (foreign-string)
+ "Convert a (possibly freshly allocated) C string into a Lisp string
+and free the C string afterwards."
+
+ (unwind-protect
+ (foreign-string-to-lisp foreign-string)
+ (foreign-string-free foreign-string)))