aboutsummaryrefslogtreecommitdiffstats
path: root/libasn1fix
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2004-09-08 00:28:11 +0000
committerLev Walkin <vlm@lionet.info>2004-09-08 00:28:11 +0000
commit1004aa946290392496309e927cd515adea93fdda (patch)
treeb516082be632c2fab4b55df8ace7a4f3254d1d58 /libasn1fix
parent699ed4bf79769500b1f97164450fd2eb2c7b20d9 (diff)
maintaining parent expression
Diffstat (limited to 'libasn1fix')
-rw-r--r--libasn1fix/asn1fix_constr.c6
-rw-r--r--libasn1fix/asn1fix_misc.c1
-rw-r--r--libasn1fix/asn1fix_param.c26
3 files changed, 22 insertions, 11 deletions
diff --git a/libasn1fix/asn1fix_constr.c b/libasn1fix/asn1fix_constr.c
index 8c9dd383..4a3b99bc 100644
--- a/libasn1fix/asn1fix_constr.c
+++ b/libasn1fix/asn1fix_constr.c
@@ -68,8 +68,10 @@ asn1f_pull_components_of(arg_t *arg) {
* Move all components of the cloned structure
* into the current one.
*/
- while((memb = TQ_REMOVE(&(coft->members), next)))
+ while((memb = TQ_REMOVE(&(coft->members), next))) {
TQ_ADD(&list, memb, next);
+ memb->parent_expr = expr;
+ }
asn1p_expr_free(coft); /* Remove wrapper */
}
@@ -159,7 +161,7 @@ asn1f_fix_constr_ext(arg_t *arg) {
asn1p_expr_free(v);
r_value = -1;
} else {
- TQ_ADD(&(expr->members), v, next);
+ asn1p_expr_add(expr, v);
}
} else {
r_value = -1;
diff --git a/libasn1fix/asn1fix_misc.c b/libasn1fix/asn1fix_misc.c
index 4ea94950..8e70c901 100644
--- a/libasn1fix/asn1fix_misc.c
+++ b/libasn1fix/asn1fix_misc.c
@@ -171,6 +171,7 @@ asn1f_recurse_expr(arg_t *arg, int (*callback)(arg_t *arg)) {
*/
TQ_FOR(arg->expr, &(expr->members), next) {
assert(arg->expr->expr_type != A1TC_INVALID);
+ assert(arg->expr->parent_expr == expr);
ret = asn1f_recurse_expr(arg, callback);
RET2RVAL(ret, rvalue);
}
diff --git a/libasn1fix/asn1fix_param.c b/libasn1fix/asn1fix_param.c
index 5ce6b933..1ecdeb10 100644
--- a/libasn1fix/asn1fix_param.c
+++ b/libasn1fix/asn1fix_param.c
@@ -58,15 +58,23 @@ asn1f_fix_parametrized_assignment(arg_t *arg) {
return asn1f_parametrize(arg, expr, ptype);
}
-#define SUBSTITUTE(to, from) do { \
- asn1p_expr_t tmp; \
- tmp = *(to); \
- *(to) = *(from); \
- *(from) = tmp; \
- (to)->next = tmp.next; \
- memset(&((from)->next), 0, \
- sizeof((from)->next)); \
- asn1p_expr_free(from); \
+#define SUBSTITUTE(to, from) do { \
+ asn1p_expr_t tmp, *__v; \
+ tmp = *(to); \
+ *(to) = *(from); \
+ TQ_MOVE(&(to)->members, &(from)->members); \
+ *(from) = tmp; \
+ (to)->next = tmp.next; \
+ (to)->parent_expr = tmp.parent_expr; \
+ memset(&((from)->next), 0, \
+ sizeof((from)->next)); \
+ memset(&((from)->members), 0, \
+ sizeof((from)->members)); \
+ asn1p_expr_free(from); \
+ TQ_FOR(__v, &((to)->members), next) { \
+ assert(__v->parent_expr == (from)); \
+ __v->parent_expr = (to); \
+ } \
} while(0)
static int