Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
836e2b28
提交
836e2b28
authored
1月 09, 2015
作者:
Anthony Minessale
提交者:
Michael Jerris
5月 28, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7500: add switch_inthash variety of hash that can key on int
上级
287a6c3c
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
62 行增加
和
10 行删除
+62
-10
switch_core.h
src/include/switch_core.h
+7
-2
switch_hashtable.h
src/include/switch_hashtable.h
+13
-0
switch_types.h
src/include/switch_types.h
+2
-0
mod_dingaling.c
src/mod/endpoints/mod_dingaling/mod_dingaling.c
+2
-2
switch_core_hash.c
src/switch_core_hash.c
+37
-5
switch_ivr.c
src/switch_ivr.c
+1
-1
没有找到文件。
src/include/switch_core.h
浏览文件 @
836e2b28
...
...
@@ -1400,9 +1400,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_wrlock(switch_hash_t *ha
\brief Delete data from a hash based on desired key
\param hash the hash to delete from
\param key the key from which to delete the data
\return
SWITCH_STATUS_SUCCESS if the data is deleted
\return
The value stored if the data is deleted otherwise NULL
*/
SWITCH_DECLARE
(
switch_status_t
)
switch_core_hash_delete
(
_In_
switch_hash_t
*
hash
,
_In_z_
const
char
*
key
);
SWITCH_DECLARE
(
void
*
)
switch_core_hash_delete
(
_In_
switch_hash_t
*
hash
,
_In_z_
const
char
*
key
);
/*!
\brief Delete data from a hash based on desired key
...
...
@@ -1491,6 +1491,11 @@ SWITCH_DECLARE(void) switch_core_hash_this(_In_ switch_hash_index_t *hi, _Out_op
const
void
**
key
,
_Out_opt_
switch_ssize_t
*
klen
,
_Out_
void
**
val
);
SWITCH_DECLARE
(
switch_status_t
)
switch_core_inthash_init
(
switch_inthash_t
**
hash
);
SWITCH_DECLARE
(
switch_status_t
)
switch_core_inthash_destroy
(
switch_inthash_t
**
hash
);
SWITCH_DECLARE
(
switch_status_t
)
switch_core_inthash_insert
(
switch_inthash_t
*
hash
,
uint32_t
key
,
const
void
*
data
);
SWITCH_DECLARE
(
void
*
)
switch_core_inthash_delete
(
switch_inthash_t
*
hash
,
uint32_t
key
);
SWITCH_DECLARE
(
void
*
)
switch_core_inthash_find
(
switch_inthash_t
*
hash
,
uint32_t
key
);
///\}
...
...
src/include/switch_hashtable.h
浏览文件 @
836e2b28
...
...
@@ -197,6 +197,19 @@ SWITCH_DECLARE(switch_hashtable_iterator_t*) switch_hashtable_first_iter(switch_
SWITCH_DECLARE
(
switch_hashtable_iterator_t
*
)
switch_hashtable_next
(
switch_hashtable_iterator_t
**
iP
);
SWITCH_DECLARE
(
void
)
switch_hashtable_this
(
switch_hashtable_iterator_t
*
i
,
const
void
**
key
,
switch_ssize_t
*
klen
,
void
**
val
);
static
inline
uint32_t
switch_hash_default_int
(
void
*
ky
)
{
uint32_t
x
=
*
((
uint32_t
*
)
ky
);
x
=
((
x
>>
16
)
^
x
)
*
0x45d9f3b
;
x
=
((
x
>>
16
)
^
x
)
*
0x45d9f3b
;
x
=
((
x
>>
16
)
^
x
);
return
x
;
}
static
inline
int
switch_hash_equalkeys_int
(
void
*
k1
,
void
*
k2
)
{
return
*
(
uint32_t
*
)
k1
==
*
(
uint32_t
*
)
k2
;
}
static
inline
int
switch_hash_equalkeys
(
void
*
k1
,
void
*
k2
)
{
return
strcmp
((
char
*
)
k1
,
(
char
*
)
k2
)
?
0
:
1
;
...
...
src/include/switch_types.h
浏览文件 @
836e2b28
...
...
@@ -735,6 +735,7 @@ typedef enum {
SWITCH_RTP_FLAG_PLI
,
SWITCH_RTP_FLAG_RESET
,
SWITCH_RTP_FLAG_MUTE
,
SWITCH_RTP_FLAG_NACK
,
SWITCH_RTP_FLAG_INVALID
}
switch_rtp_flag_t
;
...
...
@@ -2340,6 +2341,7 @@ typedef switch_xml_t(*switch_xml_search_function_t) (const char *section,
struct
switch_hashtable
;
struct
switch_hashtable_iterator
;
typedef
struct
switch_hashtable
switch_hash_t
;
typedef
struct
switch_hashtable
switch_inthash_t
;
typedef
struct
switch_hashtable_iterator
switch_hash_index_t
;
struct
switch_network_list
;
...
...
src/mod/endpoints/mod_dingaling/mod_dingaling.c
浏览文件 @
836e2b28
...
...
@@ -2025,7 +2025,7 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
if
(
tech_pvt
->
profile
->
purge
)
{
mdl_profile_t
*
profile
=
tech_pvt
->
profile
;
if
(
switch_core_hash_delete
(
globals
.
profile_hash
,
profile
->
name
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_hash_delete
(
globals
.
profile_hash
,
profile
->
name
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Profile %s deleted successfully
\n
"
,
profile
->
name
);
}
}
...
...
@@ -3261,7 +3261,7 @@ static switch_status_t destroy_profile(char *name)
ldl_handle_stop
(
profile
->
handle
);
}
if
(
switch_core_hash_delete
(
globals
.
profile_hash
,
profile
->
name
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_hash_delete
(
globals
.
profile_hash
,
profile
->
name
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Profile %s deleted successfully
\n
"
,
profile
->
name
);
}
}
...
...
src/switch_core_hash.c
浏览文件 @
836e2b28
...
...
@@ -92,11 +92,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_wrlock(switch_hash_t *ha
return
SWITCH_STATUS_SUCCESS
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_core_hash_delete
(
switch_hash_t
*
hash
,
const
char
*
key
)
SWITCH_DECLARE
(
void
*
)
switch_core_hash_delete
(
switch_hash_t
*
hash
,
const
char
*
key
)
{
switch_hashtable_remove
(
hash
,
(
void
*
)
key
);
return
SWITCH_STATUS_SUCCESS
;
return
switch_hashtable_remove
(
hash
,
(
void
*
)
key
);
}
SWITCH_DECLARE
(
switch_status_t
)
switch_core_hash_delete_locked
(
switch_hash_t
*
hash
,
const
char
*
key
,
switch_mutex_t
*
mutex
)
...
...
@@ -154,7 +152,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_multi(switch_hash_t *has
/* now delete them */
for
(
header
=
event
->
headers
;
header
;
header
=
header
->
next
)
{
if
(
switch_core_hash_delete
(
hash
,
header
->
value
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_hash_delete
(
hash
,
header
->
value
))
{
status
=
SWITCH_STATUS_SUCCESS
;
}
}
...
...
@@ -234,6 +232,40 @@ SWITCH_DECLARE(void) switch_core_hash_this(switch_hash_index_t *hi, const void *
}
SWITCH_DECLARE
(
switch_status_t
)
switch_core_inthash_init
(
switch_inthash_t
**
hash
)
{
return
switch_create_hashtable
(
hash
,
16
,
switch_hash_default_int
,
switch_hash_equalkeys_int
);
}
SWITCH_DECLARE
(
switch_status_t
)
switch_core_inthash_destroy
(
switch_inthash_t
**
hash
)
{
switch_hashtable_destroy
(
hash
);
return
SWITCH_STATUS_SUCCESS
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_core_inthash_insert
(
switch_inthash_t
*
hash
,
uint32_t
key
,
const
void
*
data
)
{
uint32_t
*
k
=
NULL
;
switch_zmalloc
(
k
,
sizeof
(
k
));
*
k
=
key
;
switch_hashtable_insert_destructor
(
hash
,
k
,
(
void
*
)
data
,
HASHTABLE_FLAG_FREE_KEY
|
HASHTABLE_DUP_CHECK
,
NULL
);
return
SWITCH_STATUS_SUCCESS
;
}
SWITCH_DECLARE
(
void
*
)
switch_core_inthash_delete
(
switch_inthash_t
*
hash
,
uint32_t
key
)
{
return
switch_hashtable_remove
(
hash
,
(
void
*
)
&
key
);
}
SWITCH_DECLARE
(
void
*
)
switch_core_inthash_find
(
switch_inthash_t
*
hash
,
uint32_t
key
)
{
return
switch_hashtable_search
(
hash
,
(
void
*
)
&
key
);
}
/* For Emacs:
* Local Variables:
* mode:c
...
...
src/switch_ivr.c
浏览文件 @
836e2b28
...
...
@@ -2065,7 +2065,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_del_event(switch_
switch_status_t
status
=
SWITCH_STATUS_FALSE
;
if
(
parser
!=
NULL
&&
digits
!=
NULL
&&
*
digits
)
{
status
=
switch_core_hash_delete
(
parser
->
hash
,
digits
);
status
=
switch_core_hash_delete
(
parser
->
hash
,
digits
)
?
SWITCH_STATUS_SUCCESS
:
SWITCH_STATUS_FALSE
;
}
if
(
status
!=
SWITCH_STATUS_SUCCESS
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论