Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
external
sofia-sip
Commits
a49aedb9
Commit
a49aedb9
authored
Sep 14, 2006
by
Pekka Pessi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
su: updated some documentation.
darcs-hash:20060914132914-65a35-722564ba83d702dc19ca69033217e3236d342ad9.gz
parent
30330bc8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
15 deletions
+49
-15
libsofia-sip-ua/su/sofia-sip/su_addrinfo.h
libsofia-sip-ua/su/sofia-sip/su_addrinfo.h
+8
-0
libsofia-sip-ua/su/sofia-sip/su_wait.h
libsofia-sip-ua/su/sofia-sip/su_wait.h
+4
-4
libsofia-sip-ua/su/su_bm.c
libsofia-sip-ua/su/su_bm.c
+37
-11
No files found.
libsofia-sip-ua/su/sofia-sip/su_addrinfo.h
View file @
a49aedb9
...
...
@@ -30,6 +30,14 @@
#ifndef SU_ADDRINFO_H
/* Defined when <sofia-sip/su_addrinfo.h> has been included */
#define SU_ADDRINFO_H
/**@ingroup su_socket
*
* @file sofia-sip/su_addrinfo.h Network address and service translation.
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
*
* @date Created: Wed Nov 30 17:07:04 EET 2005 ppessi
*/
#ifndef SU_TYPES_H
#include <sofia-sip/su_types.h>
...
...
libsofia-sip-ua/su/sofia-sip/su_wait.h
View file @
a49aedb9
...
...
@@ -139,7 +139,7 @@ typedef struct su_root_s su_root_t;
/**Default type of application context for <a href="#su_root_t">su_root_t</a>.
*
* Application may define the typedef ::su_root_magic_t to appropriate type
* by defining macro
#
SU_ROOT_MAGIC_T before including <su_wait.h>, for
* by defining macro SU_ROOT_MAGIC_T before including <su_wait.h>, for
* example,
* @code
* #define SU_ROOT_MAGIC_T struct context
...
...
@@ -152,7 +152,7 @@ typedef struct su_root_s su_root_t;
/** <a href="#su_root_t">Root context</a> pointer type.
*
* Application may define the typedef ::su_root_magic_t to appropriate type
* by defining macro
#
SU_ROOT_MAGIC_T before including <su_wait.h>, for
* by defining macro SU_ROOT_MAGIC_T
()
before including <su_wait.h>, for
* example,
* @code
* #define SU_ROOT_MAGIC_T struct context
...
...
@@ -166,7 +166,7 @@ typedef SU_ROOT_MAGIC_T su_root_magic_t;
* @link ::su_wakeup_arg_t argument type @endlink.
*
* The application can define the typedef ::su_wakeup_arg_t by defining
* the
#
SU_WAKEUP_ARG_T before including <su_wait.h>, for example,
* the SU_WAKEUP_ARG_T
()
before including <su_wait.h>, for example,
* @code
* #define SU_WAKEUP_ARG_T struct transport
* #include <su_wait.h>
...
...
@@ -178,7 +178,7 @@ typedef SU_ROOT_MAGIC_T su_root_magic_t;
/** @link ::su_wakeup_f Wakeup callback @endlink argument type.
*
* The application can define the typedef ::su_wakeup_arg_t by defining
* the
#
SU_WAKEUP_ARG_T before including <su_wait.h>, for example,
* the SU_WAKEUP_ARG_T
()
before including <su_wait.h>, for example,
* @code
* #define SU_WAKEUP_ARG_T struct transport
* #include <su_wait.h>
...
...
libsofia-sip-ua/su/su_bm.c
View file @
a49aedb9
...
...
@@ -47,10 +47,10 @@
#endif
struct
bw_fwd_table
{
unsigned
char
table
[
UCHAR_MAX
];
unsigned
char
table
[
UCHAR_MAX
+
1
];
};
/** Build forward skip table for Boyer-Moore algorithm */
/** Build forward skip table
#bm_fwd_table_t
for Boyer-Moore algorithm
.
*/
static
bm_fwd_table_t
*
bm_memmem_study0
(
char
const
*
needle
,
size_t
nlen
,
bm_fwd_table_t
*
fwd
)
...
...
@@ -62,17 +62,37 @@ bm_memmem_study0(char const *needle, size_t nlen, bm_fwd_table_t *fwd)
nlen
=
UCHAR_MAX
;
}
for
(
i
=
0
;
i
<
UCHAR_MAX
;
i
++
)
fwd
->
table
[
i
]
=
(
unsigned
char
)
nlen
;
memset
(
fwd
->
table
[
i
],
(
unsigned
char
)
nlen
,
sizeof
fwd
->
table
);
for
(
i
=
0
;
i
<
nlen
;
i
++
)
{
fwd
->
table
[(
unsigned
in
t
)
needle
[
i
]]
=
(
unsigned
char
)(
nlen
-
i
-
1
);
fwd
->
table
[(
unsigned
shor
t
)
needle
[
i
]]
=
(
unsigned
char
)(
nlen
-
i
-
1
);
}
return
fwd
;
}
/** Build forward skip table for Boyer-Moore algorithm */
/** @defgroup su_bm Fast string searching with Boyer-Moore algorithm
*
* The Boyer-Moore algorithm is used to implement fast substring search. The
* algorithm has some overhead caused by filling a table. Substring search
* then requires at most 1 / substring-length less string comparisons. On
* modern desktop hardware, Boyer-Moore algorithm is seldom faster than the
* naive implementation if the searched substring is shorter than the cache
* line.
*
*/
/**@ingroup su_bm
* @typedef struct bw_fwd_table bm_fwd_table_t;
*
* Forward skip table for Boyer-Moore algorithm.
*
*/
/** Build case-sensitive forward skip table #bm_fwd_table_t
* for Boyer-Moore algorithm.
* @ingroup su_bm
*/
bm_fwd_table_t
*
bm_memmem_study
(
char
const
*
needle
,
size_t
nlen
)
{
...
...
@@ -84,7 +104,9 @@ bm_memmem_study(char const *needle, size_t nlen)
return
fwd
;
}
/** Search for a substring using Boyer-Moore algorithm. */
/** Search for a substring using Boyer-Moore algorithm.
* @ingroup su_bm
*/
char
const
*
bm_memmem
(
char
const
*
haystack
,
size_t
hlen
,
char
const
*
needle
,
size_t
nlen
,
...
...
@@ -167,7 +189,9 @@ bm_memcasemem_study0(char const *needle, size_t nlen, bm_fwd_table_t *fwd)
return
fwd
;
}
/** Build forward skip table for Boyer-Moore algorithm */
/** Build case-insensitive forward skip table for Boyer-Moore algorithm.
* @ingroup su_bm
*/
bm_fwd_table_t
*
bm_memcasemem_study
(
char
const
*
needle
,
size_t
nlen
)
{
...
...
@@ -179,11 +203,13 @@ bm_memcasemem_study(char const *needle, size_t nlen)
return
fwd
;
}
/** Search for substring using Boyer-Moore algorithm. */
/** Search for substring using Boyer-Moore algorithm.
* @ingroup su_bm
*/
char
const
*
bm_memcasemem
(
char
const
*
haystack
,
size_t
hlen
,
char
const
*
needle
,
size_t
nlen
,
bm_fwd_table_t
*
fwd
)
char
const
*
needle
,
size_t
nlen
,
bm_fwd_table_t
*
fwd
)
{
size_t
i
,
j
;
bm_fwd_table_t
fwd0
[
1
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment