summaryrefslogtreecommitdiffstats
path: root/nsprpub/lib/libc/src/strchr.c
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2020-01-02 21:01:38 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-01-02 21:01:38 +0100
commitf7d30133221896638f7bf4f66c504255c4b14f48 (patch)
tree5f3e07a049f388a3a309a615b8884318f6668a98 /nsprpub/lib/libc/src/strchr.c
parent26b297510a11758727438df4669357a2a2bc42ce (diff)
downloadUXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar
UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar.gz
UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar.lz
UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar.xz
UXP-f7d30133221896638f7bf4f66c504255c4b14f48.zip
Issue #1338 - Part 1: Update NSPR to 4.24
Diffstat (limited to 'nsprpub/lib/libc/src/strchr.c')
-rw-r--r--nsprpub/lib/libc/src/strchr.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/nsprpub/lib/libc/src/strchr.c b/nsprpub/lib/libc/src/strchr.c
index 523378b49..7de1887dc 100644
--- a/nsprpub/lib/libc/src/strchr.c
+++ b/nsprpub/lib/libc/src/strchr.c
@@ -9,7 +9,9 @@
PR_IMPLEMENT(char *)
PL_strchr(const char *s, char c)
{
- if( (const char *)0 == s ) return (char *)0;
+ if( (const char *)0 == s ) {
+ return (char *)0;
+ }
return strchr(s, c);
}
@@ -17,7 +19,9 @@ PL_strchr(const char *s, char c)
PR_IMPLEMENT(char *)
PL_strrchr(const char *s, char c)
{
- if( (const char *)0 == s ) return (char *)0;
+ if( (const char *)0 == s ) {
+ return (char *)0;
+ }
return strrchr(s, c);
}
@@ -25,13 +29,18 @@ PL_strrchr(const char *s, char c)
PR_IMPLEMENT(char *)
PL_strnchr(const char *s, char c, PRUint32 n)
{
- if( (const char *)0 == s ) return (char *)0;
+ if( (const char *)0 == s ) {
+ return (char *)0;
+ }
for( ; n && *s; s++, n-- )
- if( *s == c )
+ if( *s == c ) {
return (char *)s;
+ }
- if( ((char)0 == c) && (n > 0) && ((char)0 == *s) ) return (char *)s;
+ if( ((char)0 == c) && (n > 0) && ((char)0 == *s) ) {
+ return (char *)s;
+ }
return (char *)0;
}
@@ -41,16 +50,21 @@ PL_strnrchr(const char *s, char c, PRUint32 n)
{
const char *p;
- if( (const char *)0 == s ) return (char *)0;
+ if( (const char *)0 == s ) {
+ return (char *)0;
+ }
for( p = s; n && *p; p++, n-- )
;
- if( ((char)0 == c) && (n > 0) && ((char)0 == *p) ) return (char *)p;
+ if( ((char)0 == c) && (n > 0) && ((char)0 == *p) ) {
+ return (char *)p;
+ }
for( p--; p >= s; p-- )
- if( *p == c )
+ if( *p == c ) {
return (char *)p;
+ }
return (char *)0;
}