perhaps too careful. to fix potential crash in TDel and TAdd
====================
This delta was composed from multiple commits as part of the CVS->Git migration.
The checkin message with each commit was inconsistent.
The following are the additional commit messages.
====================
remove extra ) which snuck in
cb->tprev = thp->tprev;
cb->tnext = *thead;
- thp->tprev = (itocb(thp->tprev)->tnext = cbtoi(cb));
+ if (thp) {
+ if (thp->tprev)
+ thp->tprev = (itocb(thp->tprev)->tnext = cbtoi(cb));
+ else
+ thp->tprev = cbtoi(cb);
+ }
}
cb->thead = ttoi(thead);
if (*thead == cbtoi(cb))
*thead = (*thead == cb->tnext? 0: cb->tnext);
- itocb(cb->tprev)->tnext = cb->tnext;
- itocb(cb->tnext)->tprev = cb->tprev;
+ if (itocb(cb->tprev))
+ itocb(cb->tprev)->tnext = cb->tnext;
+ if (itocb(cb->tnext))
+ itocb(cb->tnext)->tprev = cb->tprev;
} /*TDel*/