annotate libfdcore/apps.c @ 1562:6219359a36a9 default tip

Merge latest changes from proposed branch
author Sebastien Decugis <sdecugis@freediameter.net>
date Mon, 21 Jun 2021 19:08:18 +0800
parents 4a9f08d6b6ba
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
43
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1 /*********************************************************************************************************
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
2 * Software License Agreement (BSD License) *
740
4a9f08d6b6ba Updated my mail address
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 662
diff changeset
3 * Author: Sebastien Decugis <sdecugis@freediameter.net> *
43
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
4 * *
662
2e94ef0515d7 Updated copyright information
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 658
diff changeset
5 * Copyright (c) 2011, WIDE Project and NICT *
43
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
6 * All rights reserved. *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
7 * *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
8 * Redistribution and use of this software in source and binary forms, with or without modification, are *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
9 * permitted provided that the following conditions are met: *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
10 * *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
11 * * Redistributions of source code must retain the above *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
12 * copyright notice, this list of conditions and the *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
13 * following disclaimer. *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
14 * *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
15 * * Redistributions in binary form must reproduce the above *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
16 * copyright notice, this list of conditions and the *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
17 * following disclaimer in the documentation and/or other *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
18 * materials provided with the distribution. *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
19 * *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
20 * * Neither the name of the WIDE Project or NICT nor the *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
21 * names of its contributors may be used to endorse or *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
22 * promote products derived from this software without *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
23 * specific prior written permission of WIDE Project and *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
24 * NICT. *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
25 * *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
27 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
28 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
32 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
34 *********************************************************************************************************/
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
35
658
f198d16fa7f4 Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 648
diff changeset
36 #include "fdcore-internal.h"
43
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
37
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
38 /* Merge information into a list of apps */
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
39 int fd_app_merge(struct fd_list * list, application_id_t aid, vendor_id_t vid, int auth, int acct)
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
40 {
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
41 struct fd_list * li;
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
42 int skip = 0;
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
43
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
44 /* List is ordered by appid. Avoid duplicates */
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
45 for (li = list; li->next != list; li = li->next) {
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
46 struct fd_app * na = (struct fd_app *)(li->next);
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
47 if (na->appid < aid)
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
48 continue;
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
49
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
50 if (na->appid > aid)
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
51 break;
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
52
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
53 /* Otherwise, we merge with existing entry -- ignore vendor id in this case */
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
54 skip = 1;
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
55
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
56 if (auth)
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
57 na->flags.auth = 1;
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
58 if (acct)
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
59 na->flags.acct = 1;
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
60 break;
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
61 }
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
62
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
63 if (!skip) {
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
64 struct fd_app * new = NULL;
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
65
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
66 CHECK_MALLOC( new = malloc(sizeof(struct fd_app)) );
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
67 memset(new, 0, sizeof(struct fd_app));
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
68 fd_list_init(&new->chain, NULL);
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
69 new->flags.auth = (auth ? 1 : 0);
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
70 new->flags.acct = (acct ? 1 : 0);
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
71 new->vndid = vid;
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
72 new->appid = aid;
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
73 fd_list_insert_after(li, &new->chain);
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
74 }
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
75
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
76 return 0;
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
77 }
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
78
87
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
79 /* Check if a given application id is in a list */
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
80 int fd_app_check(struct fd_list * list, application_id_t aid, struct fd_app **detail)
43
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
81 {
87
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
82 struct fd_list * li;
43
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
83
87
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
84 TRACE_ENTRY("%p %d %p", list, aid, detail);
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
85 CHECK_PARAMS(list && detail);
43
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
86
87
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
87 *detail = NULL;
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
88
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
89 /* Search in the list */
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
90 for (li = list->next; li != list; li = li->next) {
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
91 struct fd_app * a = (struct fd_app *)li;
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
92 if (a->appid < aid)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
93 continue;
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
94
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
95 if (a->appid == aid)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
96 *detail = a;
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
97 break;
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
98 }
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
99
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
100 return 0;
43
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
101 }
105
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
102
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
103 /* Check if two lists have at least one common application */
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
104 int fd_app_check_common(struct fd_list * list1, struct fd_list * list2, int * common_found)
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
105 {
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
106 struct fd_list * li1, *li2;
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
107
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
108 TRACE_ENTRY("%p %p %p", list1, list2, common_found);
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
109 CHECK_PARAMS( list1 && list2 && common_found );
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
110
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
111 /* Both lists are ordered, so advance both pointers at the same time */
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
112 for (li1 = list1->next, li2 = list2->next; (li1 != list1) && (li2 != list2); ) {
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
113 struct fd_app * a1 = (struct fd_app *)li1, *a2 = (struct fd_app *)li2;
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
114 if (a1->appid < a2->appid) {
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
115 li1 = li1->next;
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
116 continue;
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
117 }
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
118 if (a1->appid > a2->appid) {
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
119 li2 = li2->next;
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
120 continue;
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
121 }
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
122 /* They are equal, compare the applications */
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
123 if ((a1->flags.auth && a2->flags.auth) || (a1->flags.acct && a2->flags.acct)) {
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
124 /* found! */
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
125 *common_found = 1;
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
126 return 0;
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
127 }
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
128
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
129 /* This application is not common, advance both lists */
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
130 li1 = li1->next;
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
131 li2 = li2->next;
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
132 }
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
133
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
134 /* We did not find a common app */
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
135 *common_found = 0;
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
136 return 0;
0d9c9e004be0 Compute common applications after CER reception
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 87
diff changeset
137 }
447
097bae83b07a Forgot to cleanup the configuration on exit, spotted by valgrind
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 105
diff changeset
138
097bae83b07a Forgot to cleanup the configuration on exit, spotted by valgrind
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 105
diff changeset
139 /* Remove the apps from a list */
097bae83b07a Forgot to cleanup the configuration on exit, spotted by valgrind
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 105
diff changeset
140 int fd_app_empty(struct fd_list * list)
097bae83b07a Forgot to cleanup the configuration on exit, spotted by valgrind
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 105
diff changeset
141 {
097bae83b07a Forgot to cleanup the configuration on exit, spotted by valgrind
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 105
diff changeset
142 TRACE_ENTRY("%p", list);
097bae83b07a Forgot to cleanup the configuration on exit, spotted by valgrind
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 105
diff changeset
143 CHECK_PARAMS( list );
097bae83b07a Forgot to cleanup the configuration on exit, spotted by valgrind
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 105
diff changeset
144
097bae83b07a Forgot to cleanup the configuration on exit, spotted by valgrind
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 105
diff changeset
145 while (!FD_IS_LIST_EMPTY(list)) {
097bae83b07a Forgot to cleanup the configuration on exit, spotted by valgrind
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 105
diff changeset
146 struct fd_list * li = list->next;
097bae83b07a Forgot to cleanup the configuration on exit, spotted by valgrind
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 105
diff changeset
147 fd_list_unlink(li);
097bae83b07a Forgot to cleanup the configuration on exit, spotted by valgrind
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 105
diff changeset
148 free(li);
097bae83b07a Forgot to cleanup the configuration on exit, spotted by valgrind
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 105
diff changeset
149 }
097bae83b07a Forgot to cleanup the configuration on exit, spotted by valgrind
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 105
diff changeset
150
097bae83b07a Forgot to cleanup the configuration on exit, spotted by valgrind
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 105
diff changeset
151 return 0;
097bae83b07a Forgot to cleanup the configuration on exit, spotted by valgrind
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 105
diff changeset
152 }
"Welcome to our mercurial repository"