Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ecl
ecl
Commits
2192e63e
Commit
2192e63e
authored
Sep 18, 2018
by
Marius Gerbershagen
Browse files
ffi: protect with-foreign-string and with-foreign-object against interrupts
parent
a34b6d0c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lsp/ffi.lsp
View file @
2192e63e
...
...
@@ -504,11 +504,11 @@ FREE-FOREIGN-OBJECT. Initial contents of the string are undefined."
Binds FOREIGN-STRING to a foreign string created from conversion of a
STRING and evaluated the BODY. Automatically frees the FOREIGN-STRING."
(
let
((
result
(
gensym
)))
`
(
let*
((
,
foreign-string
(
convert-to-foreign-string
,
lisp-string
))
(
,
result
(
progn
,@
body
)))
(
free-foreign-object
,
foreign-string
)
,
result
)))
`
(
let
*
((
,
foreign-string
(
convert-to-foreign-string
,
lisp-string
)))
(
mp:without-interrupts
(
unwind-protect
(
mp:with-restored-interrupts
,@
body
)
(
free-foreign-object
,
foreign-string
))
)))
(
defmacro
with-foreign-strings
(
bindings
&rest
body
)
"Syntax: (with-foreign-strings ((foreign-string string)*) &body body)
...
...
@@ -530,9 +530,10 @@ See: WITH-FOREIGN-STRING. Works similar to LET*."
Wraps the allocation, binding and destruction of a foreign object
around a body of code"
`
(
let
((
,
var
(
allocate-foreign-object
,
type
)))
(
unwind-protect
(
progn
,@
body
)
(
free-foreign-object
,
var
))))
(
mp:without-interrupts
(
unwind-protect
(
mp:with-restored-interrupts
,@
body
)
(
free-foreign-object
,
var
)))))
(
defmacro
with-foreign-objects
(
bindings
&rest
body
)
(
if
bindings
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment