Mercurial > trustbridge
annotate cinst/nss-secitemlist.c @ 1349:7840851b26b9
Added tag 0.9.4 for changeset b90df38bb6dc
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 30 Oct 2014 11:19:28 +0100 |
parents | 171124737c76 |
children |
rev | line source |
---|---|
404 | 1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=2) | |
5 * and comes with ABSOLUTELY NO WARRANTY! | |
6 * See LICENSE.txt for details. | |
7 */ | |
242
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
8 #include "nss-secitemlist.h" |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
9 |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
10 void |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
11 seciteml_push (seciteml_t **list, SECItem *item) |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
12 { |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
13 seciteml_t *newlelt; |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
14 SECItem *newitem; |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
15 newlelt = (seciteml_t *)xmalloc( sizeof(seciteml_t) ); |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
16 newitem = (SECItem *)xmalloc( sizeof(SECItem) ); |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
17 memcpy(newitem, item, sizeof(SECItem)); |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
18 newlelt->item = newitem; |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
19 newlelt->next = *list; |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
20 *list = newlelt; |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
21 } |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
22 |
493
48d7b956bd98
Change loop order of installation to only call NSS_Initialize once per db
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
23 void |
48d7b956bd98
Change loop order of installation to only call NSS_Initialize once per db
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
24 seciteml_free (seciteml_t **list) |
48d7b956bd98
Change loop order of installation to only call NSS_Initialize once per db
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
25 { |
48d7b956bd98
Change loop order of installation to only call NSS_Initialize once per db
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
26 seciteml_t *oldlelt; |
48d7b956bd98
Change loop order of installation to only call NSS_Initialize once per db
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
27 |
48d7b956bd98
Change loop order of installation to only call NSS_Initialize once per db
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
28 while (*list != NULL) |
48d7b956bd98
Change loop order of installation to only call NSS_Initialize once per db
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
29 { |
48d7b956bd98
Change loop order of installation to only call NSS_Initialize once per db
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
30 oldlelt = *list; |
48d7b956bd98
Change loop order of installation to only call NSS_Initialize once per db
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
31 *list = oldlelt->next; |
946
171124737c76
Free secitem.data and not just the list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
32 if (oldlelt->item->data) |
171124737c76
Free secitem.data and not just the list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
33 free(oldlelt->item->data); |
493
48d7b956bd98
Change loop order of installation to only call NSS_Initialize once per db
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
34 free(oldlelt->item); |
48d7b956bd98
Change loop order of installation to only call NSS_Initialize once per db
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
35 free(oldlelt); |
48d7b956bd98
Change loop order of installation to only call NSS_Initialize once per db
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
36 } |
48d7b956bd98
Change loop order of installation to only call NSS_Initialize once per db
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
37 } |
48d7b956bd98
Change loop order of installation to only call NSS_Initialize once per db
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
38 |
242
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
39 SECItem *seciteml_pop (seciteml_t **list) |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
40 { |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
41 seciteml_t *oldlelt; |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
42 SECItem *item = NULL; |
904
f89b41fa7048
Fix whitespace errors
Andre Heinecke <andre.heinecke@intevation.de>
parents:
493
diff
changeset
|
43 |
242
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
44 if (*list != NULL) |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
45 { |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
46 oldlelt = *list; |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
47 item = oldlelt->item; |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
48 *list = oldlelt->next; |
318 | 49 free(oldlelt); |
242
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
50 } |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
51 return(item); |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
52 } |