Re: pgbench - test whether a variable exists

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgbench - test whether a variable exists
Date: 2018-03-01 18:25:24
Message-ID: 20180301182524.7zr3qb2sog5e7wh7@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

re. pg_strndup() the following places could use it (skim of a very quick grep
for pg_strdup):

src/bin/pg_waldump/pg_waldump.c: *dir = pg_strdup(path);
src/bin/pg_waldump/pg_waldump.c- (*dir)[(sep - path) + 1] = '\0'; /* no strndup */

src/bin/psql/prompt.c: name = pg_strdup(p + 1);
src/bin/psql/prompt.c- nameend = strcspn(name, ":");
src/bin/psql/prompt.c- name[nameend] = '\0';

src/bin/scripts/common.c: *table = pg_strdup(spec);
src/bin/scripts/common.c- (*table)[cp - spec] = '\0'; /* no strndup */

Not a lot. It takes more code to add pg_strndup() that we would save by
adding it.

.oO(I wonder why strcspn and not strrchr ...)

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-03-01 18:26:15 Re: Sample values for pg_stat_statements
Previous Message Jesper Pedersen 2018-03-01 18:17:24 Re: [HACKERS] Runtime Partition Pruning