Changeset 105:0d9c9e004be0 in freeDiameter for freeDiameter/apps.c
- Timestamp:
- Dec 8, 2009, 1:38:43 PM (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
freeDiameter/apps.c
r87 r105 100 100 return 0; 101 101 } 102 103 /* Check if two lists have at least one common application */ 104 int fd_app_check_common(struct fd_list * list1, struct fd_list * list2, int * common_found) 105 { 106 struct fd_list * li1, *li2; 107 108 TRACE_ENTRY("%p %p %p", list1, list2, common_found); 109 CHECK_PARAMS( list1 && list2 && common_found ); 110 111 /* Both lists are ordered, so advance both pointers at the same time */ 112 for (li1 = list1->next, li2 = list2->next; (li1 != list1) && (li2 != list2); ) { 113 struct fd_app * a1 = (struct fd_app *)li1, *a2 = (struct fd_app *)li2; 114 if (a1->appid < a2->appid) { 115 li1 = li1->next; 116 continue; 117 } 118 if (a1->appid > a2->appid) { 119 li2 = li2->next; 120 continue; 121 } 122 /* They are equal, compare the applications */ 123 if ((a1->flags.auth && a2->flags.auth) || (a1->flags.acct && a2->flags.acct)) { 124 /* found! */ 125 *common_found = 1; 126 return 0; 127 } 128 129 /* This application is not common, advance both lists */ 130 li1 = li1->next; 131 li2 = li2->next; 132 } 133 134 /* We did not find a common app */ 135 *common_found = 0; 136 return 0; 137 }
Note: See TracChangeset
for help on using the changeset viewer.