Balazs Scheidler <bazsi@balabit.hu> writes:
Also, reset should be called _before_ calling the job function, and the full cleanup should be done once the thread finishes: main_loop_io_worker_thread_stop()
How I didn't find _thread_stop(), I don't know. I'll move the cleanup there (and rename it to scratch_buffers_free() or something, since that's what it does). As for reset: I don't think it makes sense in a stack-based implementation. If we have something in the trash stack, that's available. If we don't, we allocate. Release puts stuff back onto the stack, and that's about it. If a scratch buffer user forgets to release, that memory will be leaked, indeed. The advantage of an array-based implementation would be that it guards against that, and would make it easier to return GStrings in bulk. However, I don't think that's worth the effort, I don't see a case where I'd want to release more than 3-4 GStrings and wouldn't be able to afford a loop.. But thankfully, the implementation is easy to change behind the API calls, so if it turns out that there's a need for reset, it's easy to switch away from trashstack.
One whitespace nitpick that I'd care about is to start the name of the function on character 1, this makes it very easy to grep for the definition of the function.
Doh! That was a stupid error on my part, sorry. I copy & pasted the function definitions from the .h file, and forgot to reformat them. :( -- |8]