summaryrefslogtreecommitdiffstats
path: root/nsprpub/lib/libc/src/strcpy.c
diff options
context:
space:
mode:
Diffstat (limited to 'nsprpub/lib/libc/src/strcpy.c')
-rw-r--r--nsprpub/lib/libc/src/strcpy.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/nsprpub/lib/libc/src/strcpy.c b/nsprpub/lib/libc/src/strcpy.c
index 9d319aa11..f49b3e75e 100644
--- a/nsprpub/lib/libc/src/strcpy.c
+++ b/nsprpub/lib/libc/src/strcpy.c
@@ -9,7 +9,9 @@
PR_IMPLEMENT(char *)
PL_strcpy(char *dest, const char *src)
{
- if( ((char *)0 == dest) || ((const char *)0 == src) ) return (char *)0;
+ if( ((char *)0 == dest) || ((const char *)0 == src) ) {
+ return (char *)0;
+ }
return strcpy(dest, src);
}
@@ -18,17 +20,22 @@ PR_IMPLEMENT(char *)
PL_strncpy(char *dest, const char *src, PRUint32 max)
{
char *rv;
-
- if( (char *)0 == dest ) return (char *)0;
- if( (const char *)0 == src ) return (char *)0;
+
+ if( (char *)0 == dest ) {
+ return (char *)0;
+ }
+ if( (const char *)0 == src ) {
+ return (char *)0;
+ }
for( rv = dest; max && ((*dest = *src) != 0); dest++, src++, max-- )
;
#ifdef JLRU
/* XXX I (wtc) think the -- and ++ operators should be postfix. */
- while( --max )
+ while( --max ) {
*++dest = '\0';
+ }
#endif /* JLRU */
return rv;
@@ -38,10 +45,16 @@ PR_IMPLEMENT(char *)
PL_strncpyz(char *dest, const char *src, PRUint32 max)
{
char *rv;
-
- if( (char *)0 == dest ) return (char *)0;
- if( (const char *)0 == src ) return (char *)0;
- if( 0 == max ) return (char *)0;
+
+ if( (char *)0 == dest ) {
+ return (char *)0;
+ }
+ if( (const char *)0 == src ) {
+ return (char *)0;
+ }
+ if( 0 == max ) {
+ return (char *)0;
+ }
for( rv = dest, max--; max && ((*dest = *src) != 0); dest++, src++, max-- )
;