correct linku1() to handle the case tail = NULL correctly.

Now the function can be used to simplify other conditional blocks.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@24173 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Luigi Rizzo 19 years ago
parent 63b0baa757
commit 182a536722

File diff suppressed because it is too large Load Diff

@ -179,14 +179,7 @@ file : objects { $$ = parseio->pval = $1; }
objects : object {$$=$1;}
| objects object
{
if ( $1 && $2 ) {
$$=$1;
linku1($$,$2);
} else if ( $1 ) {
$$=$1;
} else if ( $2 ) {
$$=$2;
}
$$ = linku1($1, $2);
}
| objects error {$$=$1;}
;
@ -920,12 +913,13 @@ static pval * linku1(pval *head, pval *tail)
{
if (!head)
return tail;
if (!head->next) {
head->next = tail;
} else {
head->u1_last->next = tail;
if (tail) {
if (!head->next) {
head->next = tail;
} else {
head->u1_last->next = tail;
}
head->u1_last = tail;
}
head->u1_last = tail;
return head;
}

Loading…
Cancel
Save