su 1.12.11devel
Loading...
Searching...
No Matches
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
53SOFIA_BEGIN_DECLS
54
55su_inline int su_strcmp(char const *a, char const *b);
56su_inline int su_strncmp(char const *a, char const *b, size_t n);
57
58SOFIAPUBFUN char *su_strcasestr(const char *haystack, const char *needle);
59
60SOFIAPUBFUN int su_strcasecmp(char const *s1, char const *s2);
61SOFIAPUBFUN int su_strncasecmp(char const *s1, char const *s2, size_t n);
62
63SOFIAPUBFUN int su_strmatch(char const *str, char const *with);
64SOFIAPUBFUN int su_strnmatch(char const *str, char const *with, size_t n);
65
66SOFIAPUBFUN int su_casematch(char const *s1, char const *with);
67SOFIAPUBFUN int su_casenmatch(char const *s1, char const *with, size_t n);
68
69SOFIAPUBFUN size_t su_strnspn(char const *s, size_t size, char const *term);
70SOFIAPUBFUN size_t su_strncspn(char const *s, size_t ssize, char const *reject);
71
72SOFIAPUBFUN size_t su_memspn(const void *mem, size_t memlen,
73 const void *accept, size_t acceptlen);
74SOFIAPUBFUN size_t su_memcspn(const void *mem, size_t memlen,
75 const void *reject, size_t rejectlen);
76
77su_inline int su_strcmp(char const *a, char const *b)
78{
79 return strcmp(a ? a : "", b ? b : "");
80}
81
82su_inline int su_strncmp(char const *a, char const *b, size_t n)
83{
84 return strncmp(a ? a : "", b ? b : "", n);
85}
86
87SOFIA_END_DECLS
88
89#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
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:491
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:391
int su_casenmatch(char const *s1, char const *with, size_t n)
ASCII-case-insensitive string match.
Definition su_string.c:279
int su_casematch(char const *s1, char const *with)
ASCII-case-insensitive string match.
Definition su_string.c:213
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:254
int su_strmatch(char const *str, char const *with)
Check if two strings match.
Definition su_string.c:191
char * su_strcasestr(const char *haystack, const char *needle)
ASCII-case-insensitive substring search.
Definition su_string.c:46
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:333
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:449

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