From 5b6d08cd2992922b667564a49f19580f11676050 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sun, 13 Oct 2013 00:09:18 -0400 Subject: Add use of asprintf() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add asprintf(), pg_asprintf(), and psprintf() to simplify string allocation and composition. Replacement implementations taken from NetBSD. Reviewed-by: Álvaro Herrera Reviewed-by: Asif Naeem --- src/backend/bootstrap/bootstrap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/backend/bootstrap/bootstrap.c') diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index d23dc4504a..2a1af63d78 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -249,9 +249,9 @@ AuxiliaryProcessMain(int argc, char *argv[]) case 'd': { /* Turn on debugging for the bootstrap process. */ - char *debugstr = palloc(strlen("debug") + strlen(optarg) + 1); + char *debugstr; - sprintf(debugstr, "debug%s", optarg); + debugstr = psprintf("debug%s", optarg); SetConfigOption("log_min_messages", debugstr, PGC_POSTMASTER, PGC_S_ARGV); SetConfigOption("client_min_messages", debugstr, -- cgit v1.2.1