This is part #2 of a two patch series to does two things: 1) get rid of the crock that was struct continuation_arg, by replacing it by a void*, and a structure per continuation. 2) Make continuations have a mechanism to free the heap allocated arguments. Every time we are adding a continuation, we are allocating its arguments on the heap. It happens that currently, it isn't defined who is responsible to free that, so, nobody is doing it... I'm adding a new argument to add_continuation so the client now passes a function to be called either: - after the continuation has ran successfully, or, - when the continuation is being discarded. Normally, xfree is passed, but there are some cases that need to do extra work. I'm dropping the error_p argument that was passed to the continuation because: - it was only called on a really bad error, after poping the current execution target. - logically, that case is indistinguishable from discarding the continuations. This makes the continuation mechanism very similar to cleanups. In effect, they can be implemented on top of cleanups, and get rid of a bunch of duplication. So, I've, - made a struct continuation an opaque type - internally consider it a cleanup - reimplemented the continuations manipulation functions (adding, running, discarding), on top of the similar cleanup mechanisms. Tested on x86_64-unknown-linux-gnu {sync,async}. OK? -- Pedro Alves