andre@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ andre@0: /* This Source Code Form is subject to the terms of the Mozilla Public andre@0: * License, v. 2.0. If a copy of the MPL was not distributed with this andre@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ andre@0: andre@0: #include "plstr.h" andre@0: #include andre@0: andre@0: PR_IMPLEMENT(char *) andre@0: PL_strpbrk(const char *s, const char *list) andre@0: { andre@0: if( ((const char *)0 == s) || ((const char *)0 == list) ) return (char *)0; andre@0: andre@0: return strpbrk(s, list); andre@0: } andre@0: andre@0: PR_IMPLEMENT(char *) andre@0: PL_strprbrk(const char *s, const char *list) andre@0: { andre@0: const char *p; andre@0: const char *r; andre@0: andre@0: if( ((const char *)0 == s) || ((const char *)0 == list) ) return (char *)0; andre@0: andre@0: for( r = s; *r; r++ ) andre@0: ; andre@0: andre@0: for( r--; r >= s; r-- ) andre@0: for( p = list; *p; p++ ) andre@0: if( *r == *p ) andre@0: return (char *)r; andre@0: andre@0: return (char *)0; andre@0: } andre@0: andre@0: PR_IMPLEMENT(char *) andre@0: PL_strnpbrk(const char *s, const char *list, PRUint32 max) andre@0: { andre@0: const char *p; andre@0: andre@0: if( ((const char *)0 == s) || ((const char *)0 == list) ) return (char *)0; andre@0: andre@0: for( ; max && *s; s++, max-- ) andre@0: for( p = list; *p; p++ ) andre@0: if( *s == *p ) andre@0: return (char *)s; andre@0: andre@0: return (char *)0; andre@0: } andre@0: andre@0: PR_IMPLEMENT(char *) andre@0: PL_strnprbrk(const char *s, const char *list, PRUint32 max) andre@0: { andre@0: const char *p; andre@0: const char *r; andre@0: andre@0: if( ((const char *)0 == s) || ((const char *)0 == list) ) return (char *)0; andre@0: andre@0: for( r = s; max && *r; r++, max-- ) andre@0: ; andre@0: andre@0: for( r--; r >= s; r-- ) andre@0: for( p = list; *p; p++ ) andre@0: if( *r == *p ) andre@0: return (char *)r; andre@0: andre@0: return (char *)0; andre@0: }