Mercurial > trustbridge
comparison cinst/nss-secitemlist.c @ 242:809eaca3898c
Added helper functions to handle lists of NSS SECItems.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Fri, 28 Mar 2014 18:37:59 +0100 |
parents | |
children | 6ccaf25219fd |
comparison
equal
deleted
inserted
replaced
241:74d6e33c7d38 | 242:809eaca3898c |
---|---|
1 #include "nss-secitemlist.h" | |
2 | |
3 void | |
4 seciteml_push (seciteml_t **list, SECItem *item) | |
5 { | |
6 seciteml_t *newlelt; | |
7 SECItem *newitem; | |
8 newlelt = (seciteml_t *)xmalloc( sizeof(seciteml_t) ); | |
9 newitem = (SECItem *)xmalloc( sizeof(SECItem) ); | |
10 memcpy(newitem, item, sizeof(SECItem)); | |
11 newlelt->item = newitem; | |
12 newlelt->next = *list; | |
13 *list = newlelt; | |
14 } | |
15 | |
16 SECItem *seciteml_pop (seciteml_t **list) | |
17 { | |
18 seciteml_t *oldlelt; | |
19 SECItem *item = NULL; | |
20 | |
21 if (*list != NULL) | |
22 { | |
23 oldlelt = *list; | |
24 item = oldlelt->item; | |
25 *list = oldlelt->next; | |
26 } | |
27 return(item); | |
28 } |