提交 d5ae254c 编写于 作者: 饶先宏's avatar 饶先宏

202106121942 增加dlist中获得指定位置的项的API

上级 cef95312
......@@ -32,6 +32,7 @@
修改记录:
202105140816: 根据git的要求增加License
202106080611: 增加了ListItemDetach宏,解决在Destroy中不能调用listDetach的问题
202106121942: 增加了获得指定位置的项的API
*/
#ifndef __DLIST_H
......@@ -131,6 +132,11 @@ do { \
*/
int dlistItemCount(IDListVarPtr list);
/*
得到指定位置的项
*/
IDListVar* dlistGetNthItem(IDListVar* plist, int index);
/*
删除表中的每一项(每一项将调用Release)
*/
......
......@@ -207,6 +207,25 @@ int dlistItemCount(IDListVarPtr plist)
return count;
}
/*
得到指定位置的项
*/
IDListVar* dlistGetNthItem(IDListVar* plist, int index)
{
IDListVarPtr pitem, pitemtemp;
if (plist == NULL)
return NULL;
pitem = plist->__dlist_pNext;
while (pitem != plist) {
pitemtemp = pitem->__dlist_pNext;
if (index == 0)
return pitem;
index--;
pitem = pitemtemp;
}
return NULL;
}
/*
删除表中的每一项(每一项将调用Release)
*/
......
......@@ -203,7 +203,7 @@ int objectPrintInfo(PTR data, OFUNCPTR funcoutput)
objectCreateItem * pItem;
objectRegisterInit();
if (NULL == funcoutput) {
#if INCLUDE_PRINTF
#if !INCLUDE_PRINTF
data = (PTR)stdout;
funcoutput = (OFUNCPTR)fprintf;
#else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册