]> granicus.if.org Git - postgresql/commit
Get rid of use of asprintf() in favor of a more portable implementation.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 22 Oct 2013 22:42:13 +0000 (18:42 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 22 Oct 2013 22:42:13 +0000 (18:42 -0400)
commit09a89cb5fc29b47c26d151e82293fd3bef592b7b
tree0ac288fac9c8b34730cca74bd90afa06752988ce
parent586a8fc75bf266214d635cdcf527176b80f808ea
Get rid of use of asprintf() in favor of a more portable implementation.

asprintf(), aside from not being particularly portable, has a fundamentally
badly-designed API; the psprintf() function that was added in passing in
the previous patch has a much better API choice.  Moreover, the NetBSD
implementation that was borrowed for the previous patch doesn't work with
non-C99-compliant vsnprintf, which is something we still have to cope with
on some platforms; and it depends on va_copy which isn't all that portable
either.  Get rid of that code in favor of an implementation similar to what
we've used for many years in stringinfo.c.  Also, move it into libpgcommon
since it's not really libpgport material.

I think this patch will be enough to turn the buildfarm green again, but
there's still cosmetic work left to do, namely get rid of pg_asprintf()
in favor of using psprintf().  That will come in a followon patch.
18 files changed:
configure
configure.in
src/backend/libpq/auth.c
src/backend/utils/init/miscinit.c
src/backend/utils/mmgr/mcxt.c
src/bin/psql/large_obj.c
src/common/Makefile
src/common/fe_memutils.c
src/common/psprintf.c [new file with mode: 0644]
src/include/pg_config.h.in
src/include/port.h
src/include/port/win32.h
src/include/utils/palloc.h
src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
src/interfaces/ecpg/test/pgtypeslib/dt_test2.pgc
src/interfaces/libpq/fe-auth.c
src/port/asprintf.c [deleted file]
src/tools/msvc/Mkvcbuild.pm