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

Reply via email to