mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bugzilla bug 209499: backed out the change to strncpy in the previous
checkin because I noticed a subtle difference between PL_strncpy and strncpy (the code marked with JLRU).
This commit is contained in:
parent
d44c8e2932
commit
9297504571
@ -46,9 +46,20 @@ PL_strcpy(char *dest, const char *src)
|
||||
PR_IMPLEMENT(char *)
|
||||
PL_strncpy(char *dest, const char *src, PRUint32 max)
|
||||
{
|
||||
if( ((char *)0 == dest) || ((const char *)0 == src) ) return (char *)0;
|
||||
char *rv;
|
||||
|
||||
if( (char *)0 == dest ) return (char *)0;
|
||||
if( (const char *)0 == src ) return (char *)0;
|
||||
|
||||
return strncpy(dest, src, (size_t)max);
|
||||
for( rv = dest; max && ((*dest = *src) != 0); dest++, src++, max-- )
|
||||
;
|
||||
|
||||
#ifdef JLRU
|
||||
while( --max )
|
||||
*++dest = '\0';
|
||||
#endif /* JLRU */
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(char *)
|
||||
|
Loading…
Reference in New Issue
Block a user