su  1.13.17
su_string.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Sofia-SIP package
3  *
4  * Copyright (C) 2005 Nokia Corporation.
5  *
6  * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; either version 2.1 of
11  * the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  *
23  */
24 
25 #ifndef SOFIA_SIP_SU_STRING_H
27 #define SOFIA_SIP_SU_STRING_H
28 
47 #ifndef SU_CONFIG_H
48 #include <sofia-sip/su_config.h>
49 #endif
50 
51 #include <string.h>
52 
53 SOFIA_BEGIN_DECLS
54 
55 su_inline int su_strcmp(char const *a, char const *b)
56 {
57  return strcmp(a ? a : "", b ? b : "");
58 }
59 
60 su_inline int su_strncmp(char const *a, char const *b, size_t n)
61 {
62  return strncmp(a ? a : "", b ? b : "", n);
63 }
64 
65 SOFIAPUBFUN char *su_strcasestr(const char *haystack, const char *needle);
66 
67 SOFIAPUBFUN int su_strcasecmp(char const *s1, char const *s2);
68 SOFIAPUBFUN int su_strncasecmp(char const *s1, char const *s2, size_t n);
69 
70 SOFIAPUBFUN int su_strmatch(char const *str, char const *with);
71 SOFIAPUBFUN int su_strnmatch(char const *str, char const *with, size_t n);
72 
73 SOFIAPUBFUN int su_casematch(char const *s1, char const *with);
74 SOFIAPUBFUN int su_casenmatch(char const *s1, char const *with, size_t n);
75 
76 SOFIAPUBFUN size_t su_strnspn(char const *s, size_t size, char const *term);
77 SOFIAPUBFUN size_t su_strncspn(char const *s, size_t ssize, char const *reject);
78 
79 SOFIAPUBFUN size_t su_memspn(const void *mem, size_t memlen,
80  const void *accept, size_t acceptlen);
81 SOFIAPUBFUN size_t su_memcspn(const void *mem, size_t memlen,
82  const void *reject, size_t rejectlen);
83 
84 SOFIA_END_DECLS
85 
86 #endif /* !SOFIA_SIP_SU_STRING_H */
su library configuration
#define SOFIAPUBFUN
SOFIAPUBFUN declares an exported function.
Definition: su_config.h:66
#define su_inline
Define as suitable declarator static inline functions.
Definition: su_configure.h:90
char * su_strcasestr(const char *haystack, const char *needle)
ASCII-case-insensitive substring search.
Definition: su_string.c:46
int su_strncasecmp(char const *s1, char const *s2, size_t n)
ASCII-case-insensitive comparison.
Definition: su_string.c:142
size_t su_memcspn(const void *mem, size_t memlen, const void *reject, size_t rejectlen)
Search memory for bytes not in a given set.
Definition: su_string.c:493
size_t su_strncspn(char const *s, size_t ssize, char const *reject)
Search a string for a set of characters.
Definition: su_string.c:393
int su_casenmatch(char const *s1, char const *with, size_t n)
ASCII-case-insensitive string match.
Definition: su_string.c:281
int su_casematch(char const *s1, char const *with)
ASCII-case-insensitive string match.
Definition: su_string.c:215
int su_strcasecmp(char const *s1, char const *s2)
ASCII-case-insensitive comparison.
Definition: su_string.c:101
int su_strnmatch(char const *str, char const *with, size_t n)
String prefix match.
Definition: su_string.c:256
int su_strmatch(char const *str, char const *with)
Check if two strings match.
Definition: su_string.c:193
size_t su_strnspn(char const *s, size_t size, char const *term)
Search a string for a set of characters.
Definition: su_string.c:335
size_t su_memspn(const void *mem, size_t memlen, const void *accept, size_t acceptlen)
Scan memory for a set of bytes.
Definition: su_string.c:451

Sofia-SIP 1.13.17 - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.