version 1.14, 2016/01/12 17:48:04 |
version 1.15, 2016/09/17 15:06:41 |
|
|
* Put all the entries on the free list. |
* Put all the entries on the free list. |
* Leave one for the "spare". |
* Leave one for the "spare". |
*/ |
*/ |
for (p = pool; p < &pool[NPOOL-2]; p++) |
for (p = pool; p < &pool[NPOOL-2]; p++) |
p->next = p+1; |
p->next = p+1; |
pool[NPOOL-2].next = NULL; |
pool[NPOOL-2].next = NULL; |
freelist = pool; |
freelist = pool; |
|
|
* Find the proper place in the list for the new one. |
* Find the proper place in the list for the new one. |
* The entries are sorted by position. |
* The entries are sorted by position. |
*/ |
*/ |
for (p = anchor.next; p != &anchor && p->pos < pos; p = p->next) |
for (p = anchor.next; p != &anchor && p->pos < pos; p = p->next) |
if (p->line == linenum) |
if (p->line == linenum) |
/* We already have this one. */ |
/* We already have this one. */ |
return; |
return; |
|
|
* not computed by calcgap. |
* not computed by calcgap. |
*/ |
*/ |
mingap = anchor.next->gap; |
mingap = anchor.next->gap; |
for (p = anchor.next; p->next != &anchor; p = p->next) { |
for (p = anchor.next; p->next != &anchor; p = p->next) { |
if (p->gap <= mingap) { |
if (p->gap <= mingap) { |
spare = p; |
spare = p; |
mingap = p->gap; |
mingap = p->gap; |
|
|
/* |
/* |
* Find the entry nearest to the position we want. |
* Find the entry nearest to the position we want. |
*/ |
*/ |
for (p = anchor.next; p != &anchor && p->pos < pos; p = p->next) |
for (p = anchor.next; p != &anchor && p->pos < pos; p = p->next) |
continue; |
continue; |
if (p->pos == pos) |
if (p->pos == pos) |
/* Found it exactly. */ |
/* Found it exactly. */ |
|
|
/* |
/* |
* Find the entry nearest to the line number we want. |
* Find the entry nearest to the line number we want. |
*/ |
*/ |
for (p = anchor.next; p != &anchor && p->line < linenum; p = p->next) |
for (p = anchor.next; p != &anchor && p->line < linenum; p = p->next) |
continue; |
continue; |
if (p->line == linenum) |
if (p->line == linenum) |
/* Found it exactly. */ |
/* Found it exactly. */ |