From 0b9466fce2cf4f8c32b3a9170ca272829aa11e66 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Wed, 4 Dec 2019 19:36:06 -0300 Subject: Offer pnstrdup to frontend code We already had it on the backend. Frontend can also use it now. Discussion: https://postgr.es/m/20191204144021.GA17976@alvherre.pgsql --- src/bin/scripts/common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/bin/scripts/common.c') diff --git a/src/bin/scripts/common.c b/src/bin/scripts/common.c index 680bbb133a3..965572897f9 100644 --- a/src/bin/scripts/common.c +++ b/src/bin/scripts/common.c @@ -353,8 +353,7 @@ splitTableColumnsSpec(const char *spec, int encoding, else cp += PQmblen(cp, encoding); } - *table = pg_strdup(spec); - (*table)[cp - spec] = '\0'; /* no strndup */ + *table = pnstrdup(spec, cp - spec); *columns = cp; } -- cgit v1.2.3