blob: 8ba511ad60ec4d4e196dcd73d82a916cb13dfa94 [file] [log] [blame]
Lev Walkinf15320b2004-06-03 03:38:44 +00001#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 */
10asn1p_xports_t *
11asn1p_xports_new() {
12 asn1p_xports_t *xp;
13
14 xp = calloc(1, sizeof *xp);
15 if(xp) {
Lev Walkin1a49ced2017-11-06 00:07:00 -080016 TQ_INIT(&(xp->xp_members));
Lev Walkinf15320b2004-06-03 03:38:44 +000017 }
18
19 return xp;
20}
21
22/*
23 * Destroy the xports structure.
24 */
25void
26asn1p_xports_free(asn1p_xports_t *xp) {
27 if(xp) {
Bi-Ruei, Chiu3dcf05b2017-05-04 21:45:05 +080028 asn1p_expr_t *expr;
29
Lev Walkind8b83642016-03-14 02:00:27 -070030 free(xp->fromModuleName);
Lev Walkin13e57ef2016-03-14 02:05:23 -070031 asn1p_oid_free(xp->identifier.oid);
Bi-Ruei, Chiu3dcf05b2017-05-04 21:45:05 +080032
Lev Walkin1a49ced2017-11-06 00:07:00 -080033 while((expr = TQ_REMOVE(&(xp->xp_members), next)))
Bi-Ruei, Chiu3dcf05b2017-05-04 21:45:05 +080034 asn1p_expr_free(expr);
35
Lev Walkinf15320b2004-06-03 03:38:44 +000036 free(xp);
37 }
38}