pj_list_search() loop issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Benny
I have a question about pj_list_search().
If there is no any data (count = 0) in the list, and use pj_list_search() to search node will cause loop issue.
?
Here is a pseudo code:
/*
?* Declare a struct for a data list.
?*/
struct pjsua_test_list
{
??? PJ_DECL_LIST_MEMBER(struct pjsua_test);
??? int?????? acc_id;???? /**< Account ID. */
??? int?????? call_id;???? /**<? Call ID */
};
pjsua_test_list ua_test;

case 1:
If I did not push_back or insert any data in the link, and use this pj_list_search() directly.
It will cause a loop issue.
?
case 2:
If I insert a data before then erase it, and use pj_list_search() to search, it also cause a loop.
pjsua_test_list *ua_data;
...
pj_list_push_back(&ua_test, ua_data);
pj_list_erase(ua_data);
pj_list_search(&ua_test, pjcu_callid, &compare_node);
==>loop...
?
If there is no any node link in the ua_test, there is no situation to match break condition.
Because the input of the first arg in the pj_list_search() is the point of the address.
Though, it can use pj_list_size() or pj_list_empty() to check before use pj_list_search().

Is it a issue or that is pjsip design original.
?
Best Regards
DaCheng

___________________________________________________ 
 ??????? ? ???????????????? 
 http://messenger.yahoo.com.tw/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20100128/12e2a371/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux