Re: Faster StrNCpy - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Faster StrNCpy
Date
Msg-id 29714.1159304039@sss.pgh.pa.us
Whole thread Raw
In response to Re: Faster StrNCpy  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: Faster StrNCpy  (Neil Conway <neilc@samurai.com>)
List pgsql-hackers
Martijn van Oosterhout <kleptog@svana.org> writes:
> I think that's why strlcpy was invented, to deal with the issues with
> strncpy.
> http://www.gratisoft.us/todd/papers/strlcpy.html

strlcpy does more than we need (note that none of the existing uses care
about counting the overflowed bytes).  Not sure if it's worth adopting
those semantics when they're not really standard, but if you think a lot
of people would be familiar with strlcpy, maybe we should.

> Do you really think it's worth making a macro rather than just a normal
> function?

Only in that a macro in c.h is less work than a configure test plus a
replacement file in src/port.  But if we want to consider this a
standard function that just doesn't happen to exist everywhere, I
suppose we should use configure.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Faster StrNCpy
Next
From: Neil Conway
Date:
Subject: Re: Faster StrNCpy