Mercurial > trustbridge
annotate cinst/nss-secitemlist.c @ 439:c88090a15ae4
Fix cinstprocesstest for new arguments. Handle errno on write errors
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Tue, 22 Apr 2014 13:27:23 +0000 |
parents | 17e1c8f37d72 |
children | 48d7b956bd98 |
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 |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
23 SECItem *seciteml_pop (seciteml_t **list) |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
24 { |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
25 seciteml_t *oldlelt; |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
26 SECItem *item = NULL; |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
27 |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
28 if (*list != NULL) |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
29 { |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
30 oldlelt = *list; |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
31 item = oldlelt->item; |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
32 *list = oldlelt->next; |
318 | 33 free(oldlelt); |
242
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
34 } |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
35 return(item); |
809eaca3898c
Added helper functions to handle lists of NSS SECItems.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
36 } |