Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
AW-List
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
规范查询wiki:
http://gitlab.anweitech.com/root/AW-Project-Manage/wikis/pages
Open sidebar
周尚
AW-List
Commits
64e59175
提交
64e59175
authored
6月 28, 2021
作者:
zhoush
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化: find_node 新增内存检查
上级
83a2236d
流水线
#3142
已失败 于阶段
变更
2
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
8 行增加
和
7 行删除
+8
-7
AWList.c
AWList.c
+6
-6
AWList.h
AWList.h
+2
-1
没有找到文件。
AWList.c
浏览文件 @
64e59175
...
@@ -25,10 +25,8 @@ AWList *AWList_init(AWList *list)
...
@@ -25,10 +25,8 @@ AWList *AWList_init(AWList *list)
void
AWList_destroy
(
AWList
*
list
)
void
AWList_destroy
(
AWList
*
list
)
{
{
if
(
!
list
)
{
if
(
!
list
)
return
;
return
;
}
AWList_clear
(
list
);
AWList_clear
(
list
);
free
(
list
->
head
);
free
(
list
->
head
);
...
@@ -44,6 +42,7 @@ void AWList_clear(AWList *list)
...
@@ -44,6 +42,7 @@ void AWList_clear(AWList *list)
}
}
for
(;
list
->
tail
!=
list
->
head
;
AWList_delete_node
(
list
,
list
->
tail
))
for
(;
list
->
tail
!=
list
->
head
;
AWList_delete_node
(
list
,
list
->
tail
))
;
;
list
->
iter
=
list
->
head
;
}
}
AWNode
*
AWNode_init
(
void
*
data
,
void
(
*
delete_func
)(
void
*
))
AWNode
*
AWNode_init
(
void
*
data
,
void
(
*
delete_func
)(
void
*
))
...
@@ -124,6 +123,9 @@ AWNode *AWList_find_node(AWList *list, void *data,
...
@@ -124,6 +123,9 @@ AWNode *AWList_find_node(AWList *list, void *data,
AWNode
*
node
;
AWNode
*
node
;
AWList_for_each
(
node
,
list
)
AWList_for_each
(
node
,
list
)
{
{
if
(
!
node
||
!
data
)
{
return
NULL
;
}
if
(
cmp_callback
(
node
->
data
,
data
)
==
0
)
if
(
cmp_callback
(
node
->
data
,
data
)
==
0
)
return
node
;
return
node
;
}
}
...
@@ -136,12 +138,10 @@ AWNode *AWList_iterator(AWList *list)
...
@@ -136,12 +138,10 @@ AWNode *AWList_iterator(AWList *list)
if
(
!
list
||
list
->
iter
==
list
->
tail
->
next
)
if
(
!
list
||
list
->
iter
==
list
->
tail
->
next
)
return
NULL
;
return
NULL
;
if
(
list
->
iter
==
list
->
head
)
{
if
(
list
->
iter
==
list
->
head
)
list
->
iter
=
list
->
head
->
next
;
list
->
iter
=
list
->
head
->
next
;
}
AWNode
*
iter
=
list
->
iter
;
AWNode
*
iter
=
list
->
iter
;
if
(
list
->
iter
)
{
if
(
list
->
iter
)
{
list
->
iter
=
list
->
iter
->
next
;
list
->
iter
=
list
->
iter
->
next
;
}
}
...
...
AWList.h
浏览文件 @
64e59175
...
@@ -105,7 +105,8 @@ void AWList_add_tail(AWList *list, void *data, void (*delete_func)(void *));
...
@@ -105,7 +105,8 @@ void AWList_add_tail(AWList *list, void *data, void (*delete_func)(void *));
*
*
* @param list pointer of list
* @param list pointer of list
* @param data key data to find
* @param data key data to find
* @param cmp_callback callback to use data
* @param cmp_callback callback to use data,
* 0: node->data is equal to the data to find
*
*
* @return the pointer of the node if exists, NULL if not found
* @return the pointer of the node if exists, NULL if not found
*/
*/
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论