From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: Faster StrNCpy |
Date: | 2006-09-26 20:40:18 |
Message-ID: | 20060926204018.GF19913@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
On Tue, Sep 26, 2006 at 04:24:51PM -0400, Tom Lane wrote:
> David Strong points out here
> http://archives.postgresql.org/pgsql-hackers/2006-09/msg02071.php
> that some popular implementations of strncpy(dst,src,n) are quite
> inefficient when strlen(src) is much less than n, because they don't
> optimize the zero-pad step that is required by the standard.
I think that's why strlcpy was invented, to deal with the issues with
strncpy.
http://www.gratisoft.us/todd/papers/strlcpy.html
There's an implementation here (used in glib), though you could
probably find more.
http://mail.gnome.org/archives/gtk-devel-list/2000-May/msg00029.html
Do you really think it's worth making a macro rather than just a normal
function?
Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2006-09-26 20:49:37 | Re: Faster StrNCpy |
Previous Message | Dragan Zubac | 2006-09-26 20:39:18 | PostgreSQL HA questions |
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2006-09-26 20:49:37 | Re: Faster StrNCpy |
Previous Message | Tom Lane | 2006-09-26 20:24:51 | Faster StrNCpy |