On Mon, Oct 3, 2016 at 5:55 PM, Andres Freund <and...@anarazel.de> wrote:
> /*
>  * pnstrdup
>  *              Like pstrdup(), but append null byte to a
>  *              not-necessarily-null-terminated input string.
>  */
> char *
> pnstrdup(const char *in, Size len)
> {
>         char       *out = palloc(len + 1);
>
>         memcpy(out, in, len);
>         out[len] = '\0';
>         return out;
> }
>
> isn't that a somewhat weird behaviour / implementation? Not really like
> strndup(), which one might believe to be analoguous...

Yikes!

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to