This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] strcpy optimizations


On Wed, Jan 30, 2013 at 01:49:56PM +0100, Ondřej Bílka wrote:
> On Wed, Jan 30, 2013 at 01:26:14PM +0100, Petr Baudis wrote:
> > On Tue, Jan 29, 2013 at 01:30:09PM -0800, Paul Eggert wrote:
> > > strncpy should be lower priority, I'd say.  Typically, a program
> > > that uses strncpy doesn't care all that much about performance.
> > 
> > That seems a most intriguing insight to me. Why would that be so?
> >
> Because of c standard strncpy must zero remaining bytes upto n. 
> 
> This is problematic, for example when we set strncpy breakpoint in gimp
> then first entry is:
> 
> strncpy (x=0x7fffffffc3a0 "@P[\366\377\177", y=0x7ffff2a0961f "/usr/share/X11/locale", n=4096)

Right! I'm stupid, somehow I was thinking strncmp in my head...

Sorry for the noise,

				Petr "Pasky" Baudis


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]