comparison nspr/lib/libc/src/strpbrk.c @ 0:1e5118fa0cb1

This is NSS with a Cmake Buildsyste To compile a static NSS library for Windows we've used the Chromium-NSS fork and added a Cmake buildsystem to compile it statically for Windows. See README.chromium for chromium changes and README.trustbridge for our modifications.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 28 Jul 2014 10:47:06 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1e5118fa0cb1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #include "plstr.h"
7 #include <string.h>
8
9 PR_IMPLEMENT(char *)
10 PL_strpbrk(const char *s, const char *list)
11 {
12 if( ((const char *)0 == s) || ((const char *)0 == list) ) return (char *)0;
13
14 return strpbrk(s, list);
15 }
16
17 PR_IMPLEMENT(char *)
18 PL_strprbrk(const char *s, const char *list)
19 {
20 const char *p;
21 const char *r;
22
23 if( ((const char *)0 == s) || ((const char *)0 == list) ) return (char *)0;
24
25 for( r = s; *r; r++ )
26 ;
27
28 for( r--; r >= s; r-- )
29 for( p = list; *p; p++ )
30 if( *r == *p )
31 return (char *)r;
32
33 return (char *)0;
34 }
35
36 PR_IMPLEMENT(char *)
37 PL_strnpbrk(const char *s, const char *list, PRUint32 max)
38 {
39 const char *p;
40
41 if( ((const char *)0 == s) || ((const char *)0 == list) ) return (char *)0;
42
43 for( ; max && *s; s++, max-- )
44 for( p = list; *p; p++ )
45 if( *s == *p )
46 return (char *)s;
47
48 return (char *)0;
49 }
50
51 PR_IMPLEMENT(char *)
52 PL_strnprbrk(const char *s, const char *list, PRUint32 max)
53 {
54 const char *p;
55 const char *r;
56
57 if( ((const char *)0 == s) || ((const char *)0 == list) ) return (char *)0;
58
59 for( r = s; max && *r; r++, max-- )
60 ;
61
62 for( r--; r >= s; r-- )
63 for( p = list; *p; p++ )
64 if( *r == *p )
65 return (char *)r;
66
67 return (char *)0;
68 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)