scratch-buffers: Support any number of stacks

Instead of being tied to GStrings only, support registering new kinds
of stacks, which will be automatiaclly free'd on thread shutdown. For
convenience, wrappers are provided for GString-based scratch buffer
acquire and release, and that stack is automatically registered and
free'd by the library itself.

This fixes #2.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>