From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Get rid of use of asprintf() in favor of a more portable impleme |
Date: | 2013-10-22 22:42:31 |
Message-ID: | E1VYkel-0002Ir-Pw@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/09a89cb5fc29b47c26d151e82293fd3bef592b7b
Modified Files
--------------
configure | 3 +-
configure.in | 2 +-
src/backend/libpq/auth.c | 6 +-
src/backend/utils/init/miscinit.c | 4 +-
src/backend/utils/mmgr/mcxt.c | 49 -----
src/bin/psql/large_obj.c | 8 +-
src/common/Makefile | 2 +-
src/common/fe_memutils.c | 39 ----
src/common/psprintf.c | 207 ++++++++++++++++++++
src/include/pg_config.h.in | 3 -
src/include/port.h | 5 -
src/include/port/win32.h | 9 -
src/include/utils/palloc.h | 8 +-
.../ecpg/test/expected/pgtypeslib-dt_test2.c | 9 +-
src/interfaces/ecpg/test/pgtypeslib/dt_test2.pgc | 9 +-
src/interfaces/libpq/fe-auth.c | 15 +-
src/port/asprintf.c | 111 -----------
src/tools/msvc/Mkvcbuild.pm | 4 +-
18 files changed, 251 insertions(+), 242 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2013-10-22 23:40:37 | pgsql: Replace pg_asprintf() with psprintf(). |
Previous Message | Peter Eisentraut | 2013-10-22 11:05:51 | pgsql: Make use of psprintf() in recent changes |