Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 1 | #include <stdlib.h> |
| 2 | #include <string.h> |
| 3 | |
| 4 | #include "asn1parser.h" |
| 5 | |
| 6 | /* |
| 7 | * Construct a new structure that would hold the EXPORTS or IMPORTS |
| 8 | * clause data. |
| 9 | */ |
| 10 | asn1p_xports_t * |
| 11 | asn1p_xports_new() { |
| 12 | asn1p_xports_t *xp; |
| 13 | |
| 14 | xp = calloc(1, sizeof *xp); |
| 15 | if(xp) { |
| 16 | TQ_INIT(&(xp->members)); |
| 17 | } |
| 18 | |
| 19 | return xp; |
| 20 | } |
| 21 | |
| 22 | /* |
| 23 | * Destroy the xports structure. |
| 24 | */ |
| 25 | void |
| 26 | asn1p_xports_free(asn1p_xports_t *xp) { |
| 27 | if(xp) { |
Bi-Ruei, Chiu | 3dcf05b | 2017-05-04 21:45:05 +0800 | [diff] [blame] | 28 | asn1p_expr_t *expr; |
| 29 | |
Lev Walkin | d8b8364 | 2016-03-14 02:00:27 -0700 | [diff] [blame] | 30 | free(xp->fromModuleName); |
Lev Walkin | 13e57ef | 2016-03-14 02:05:23 -0700 | [diff] [blame] | 31 | asn1p_oid_free(xp->identifier.oid); |
Bi-Ruei, Chiu | 3dcf05b | 2017-05-04 21:45:05 +0800 | [diff] [blame] | 32 | |
| 33 | while((expr = TQ_REMOVE(&(xp->members), next))) |
| 34 | asn1p_expr_free(expr); |
| 35 | |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 36 | free(xp); |
| 37 | } |
| 38 | } |