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
This commit is contained in:
Luigi Rizzo
2006-05-02 14:08:18 +00:00
parent 63b0baa757
commit 182a536722
2 changed files with 180 additions and 192 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -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;
}