open_memstream(3) is a standard way to obtain the same feature we do get by using sbuf(9) (aka dynamic size buffer), switching to using it makes pkg(7) more portable, and reduces its number of dependencies. Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D30005