Changeset 192


Ignore:
Timestamp:
Feb 19, 2006 1:28:21 AM (19 years ago)
Author:
bennylp
Message:

Added pj_list_size()

Location:
pjproject/trunk/pjlib/include/pj
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/list.h

    r107 r192  
    251251 
    252252/** 
     253 * Traverse the list to get the number of elements in the list. 
     254 * 
     255 * @param list      The list head. 
     256 * 
     257 * @return          Number of elements. 
     258 */ 
     259PJ_IDECL(pj_size_t) pj_list_size(pj_list_type *list); 
     260 
     261 
     262/** 
    253263 * @} 
    254264 */ 
  • pjproject/trunk/pjlib/include/pj/list_i.h

    r66 r192  
    117117} 
    118118 
     119 
     120PJ_IDEF(pj_size_t) pj_list_size(pj_list_type *list) 
     121{ 
     122    pj_list *node = (pj_list*) ((pj_list*)list)->next; 
     123    pj_size_t count = 0; 
     124 
     125    while (node != list) { 
     126        ++count; 
     127        node = node->next; 
     128    } 
     129 
     130    return count; 
     131} 
     132 
Note: See TracChangeset for help on using the changeset viewer.