Skip to content

Commit

Permalink
re-arrange code to make it clearer what's going on
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed May 9, 2013
1 parent ba6f084 commit 50e9675
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main/parser.c
Expand Up @@ -576,13 +576,14 @@ static ssize_t condition_tokenize(TALLOC_CTX *ctx, char const *start, int brace,
if ((c->type == COND_TYPE_CHILD) && !c->data.child->next) {
fr_cond_t *child;

child = c->data.child;
child->next = c->next;
(void) talloc_steal(child, child->next);
child->next_op = c->next_op;
c->next = NULL;
child = talloc_steal(ctx, c->data.child);
c->data.child = NULL;

child->next = talloc_steal(child, c->next);
c->next = NULL;

child->next_op = c->next_op;

/*
* Set the negation properly
*/
Expand All @@ -592,8 +593,7 @@ static ssize_t condition_tokenize(TALLOC_CTX *ctx, char const *start, int brace,
} else {
child->negate = false;
}

(void) talloc_steal(ctx, child);

talloc_free(c);
c = child;
}
Expand All @@ -608,9 +608,9 @@ static ssize_t condition_tokenize(TALLOC_CTX *ctx, char const *start, int brace,
!c->next && !c->negate) {
fr_cond_t *child;

child = c->data.child;
child = talloc_steal(ctx, c->data.child);
c->data.child = NULL;
(void) talloc_steal(ctx, child);

talloc_free(c);
c = child;
}
Expand Down

0 comments on commit 50e9675

Please sign in to comment.