1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

What if malloc?

It no longer crashes, so, that’s cool.
This commit is contained in:
Rob Rix 2015-11-25 18:32:48 -05:00
parent 03f8e43e0c
commit 5162128c40

View File

@ -96,9 +96,9 @@ toTerm document contents node = do
fixedProductions = Data.Set.fromList [ "pair", "rel_op", "math_op", "bool_op", "bitwise_op", "type_op", "math_assignment", "assignment", "subscript_access", "member_access", "new_expression", "function_call", "function", "ternary" ]
withAlloc :: Storable a => (Ptr a -> IO b) -> IO b
withAlloc writer = do
node <- mallocForeignPtr
withForeignPtr node writer
withAlloc f = do
bytes <- malloc
f bytes
namedChildren :: Ptr TSNode -> IO [Ptr TSNode]
namedChildren node = do