summaryrefslogtreecommitdiff
path: root/Lisp/type-conversion.lisp
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2007-08-06 18:11:08 +0200
committerMatthias Benkard <code@mail.matthias.benkard.de>2007-08-06 18:11:08 +0200
commite7524b783a7e2219e16c64dde7a9f965b75ed970 (patch)
tree0a2428ad4dff3ee4fa924a2b2dd0839523618342 /Lisp/type-conversion.lisp
parentb423c77db3caafb5eeb55cf185893aba8c23b842 (diff)
If necessary, deallocate a C string after converting it.
darcs-hash:4f83783092400107dd9b58671d11d4cb6a9d5214
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)))