gpgme-tool: Use membuf functions to build up strings. master
authorWerner Koch <wk@gnupg.org>
Thu, 11 Oct 2012 15:02:50 +0000 (17:02 +0200)
committerWerner Koch <wk@gnupg.org>
Thu, 11 Oct 2012 15:02:50 +0000 (17:02 +0200)
commite11e7fc5586613525035c3358e15ae24accb96ea
tree46e496deef00ae7f7f1785f640ba06a11afa933c
parentaa30b47aa010bf46876f2335e288f8bd8718e396
gpgme-tool: Use membuf functions to build up strings.

* src/gpgme-tool.c (clear_membuf, init_membuf, put_membuf)
(put_membuf_str, get_membuf, peek_membuf): Add membuf functions.
Take from GnuPG master's common/membuf.[ch] and patch for our use.
(result_xml_escape): Rewrite using new functions.
--

First counting, then allocating, and finally copying data is prone to
errors.  We better use the membuf functions which make it much easier.
src/gpgme-tool.c