Re: Faster StrNCpy

From: Benny Amorsen <benny+usenet(at)amorsen(dot)dk>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Faster StrNCpy
Date: 2006-10-03 13:21:12
Message-ID: m3sli5v8l3.fsf@ursa.amorsen.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

>>>>> "ZA" == Zeugswetter Andreas DCP SD <ZeugswetterA(at)spardat(dot)at> writes:

ZA> Yes, but it obviously does not in some ports, and that was the
ZA> main problem as I interpreted it.

strncpy is part of POSIX; I highly doubt anyone gets it wrong. Getting
sane semantics from it does require manually writing null to the
last location in the buffer.

If you need the null byte padding feature of strncpy, it seems a bit
silly to replace it with strlcpy. Particularly if the only reason is
performance. Down that road lies pglibc.

/Benny

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-10-03 13:59:03 Re: [HACKERS] Bad bug in fopen() wrapper code
Previous Message Zdenek Kotala 2006-10-03 12:41:41 PG qsort vs. Solaris

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-10-03 13:59:03 Re: [HACKERS] Bad bug in fopen() wrapper code
Previous Message Zeugswetter Andreas DCP SD 2006-10-03 11:56:57 Re: Faster StrNCpy