pgsql: Get rid of use of asprintf() in favor of a more portable impleme

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Get rid of use of asprintf() in favor of a more portable impleme
Дата
Msg-id E1VYkel-0002Ir-Pw@gemulon.postgresql.org
обсуждение исходный текст
Список 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(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: Make use of psprintf() in recent changes
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Replace pg_asprintf() with psprintf().