Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
阿啄debugIT
libfastcommon
提交
350f9237
L
libfastcommon
项目概览
阿啄debugIT
/
libfastcommon
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libfastcommon
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
350f9237
编写于
10月 26, 2018
作者:
Y
YuQing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add function hash_find1 and hash_find2
上级
d27948ed
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
50 addition
and
1 deletion
+50
-1
HISTORY
HISTORY
+2
-1
src/hash.c
src/hash.c
+18
-0
src/hash.h
src/hash.h
+30
-0
未找到文件。
HISTORY
浏览文件 @
350f9237
Version 1.40 2018-10-
11
Version 1.40 2018-10-
26
* add function conn_pool_parse_server_info and conn_pool_load_server_info
* support directive: #@add_annotation, for example:
#@add_annotation CONFIG_GET /usr/lib/libshmcache.so /etc/libshmcache.conf
...
...
@@ -8,6 +8,7 @@ Version 1.40 2018-10-11
* add function fc_strdup
* add function fc_memmem
* add function format_http_date
* add function hash_find1 and hash_find2
Version 1.39 2018-07-31
* add #@function REPLACE_VARS
...
...
src/hash.c
浏览文件 @
350f9237
...
...
@@ -568,6 +568,24 @@ void *hash_find(HashArray *pHash, const void *key, const int key_len)
}
}
int
hash_find2
(
HashArray
*
pHash
,
const
string_t
*
key
,
string_t
*
value
)
{
HashData
*
hdata
;
if
((
hdata
=
hash_find1_ex
(
pHash
,
key
))
==
NULL
)
{
return
ENOENT
;
}
value
->
str
=
hdata
->
value
;
value
->
len
=
hdata
->
value_len
;
return
0
;
}
HashData
*
hash_find1_ex
(
HashArray
*
pHash
,
const
string_t
*
key
)
{
return
hash_find_ex
(
pHash
,
key
->
str
,
key
->
len
);
}
int
hash_get
(
HashArray
*
pHash
,
const
void
*
key
,
const
int
key_len
,
void
*
value
,
int
*
value_len
)
{
...
...
src/hash.h
浏览文件 @
350f9237
...
...
@@ -198,6 +198,36 @@ void *hash_find(HashArray *pHash, const void *key, const int key_len);
*/
HashData
*
hash_find_ex
(
HashArray
*
pHash
,
const
void
*
key
,
const
int
key_len
);
/**
* hash find key
* parameters:
* pHash: the hash table
* key: the key to find
* return user data, return NULL when the key not exist
*/
static
inline
void
*
hash_find1
(
HashArray
*
pHash
,
const
string_t
*
key
)
{
return
hash_find
(
pHash
,
key
->
str
,
key
->
len
);
}
/**
* hash get the value of the key
* parameters:
* pHash: the hash table
* key: the key to find
* value: store the value
* return 0 for success, != 0 fail (errno)
*/
int
hash_find2
(
HashArray
*
pHash
,
const
string_t
*
key
,
string_t
*
value
);
/**
* hash find key
* parameters:
* pHash: the hash table
* key: the key to find
* return hash data, return NULL when the key not exist
*/
HashData
*
hash_find1_ex
(
HashArray
*
pHash
,
const
string_t
*
key
);
/**
* hash get the value of the key
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录