| 50 |
|
if (complist == NULL) |
| 51 |
|
goto memerr; |
| 52 |
|
bcopy((char *)clist, (char *)complist, nents*sizeof(PACKHEAD)); |
| 53 |
< |
complen = nents; |
| 54 |
< |
listpos = 0; |
| 55 |
< |
lastin = -1; /* flag for initial sort */ |
| 53 |
> |
complen = nents; /* finish initialization below */ |
| 54 |
|
break; |
| 55 |
|
case BS_ADD: /* add to computation set */ |
| 56 |
|
case BS_ADJ: /* adjust set quantities */ |
| 57 |
|
if (nents <= 0) |
| 58 |
|
return; |
| 59 |
|
/* merge any common members */ |
| 60 |
< |
for (i = 0; i < complen; i++) { |
| 61 |
< |
for (n = 0; n < nents; n++) |
| 60 |
> |
for (n = 0; n < nents; n++) { |
| 61 |
> |
for (i = 0; i < complen; i++) |
| 62 |
|
if (clist[n].bi == complist[i].bi && |
| 63 |
|
clist[n].hd == complist[i].hd) { |
| 64 |
+ |
int oldnr = complist[i].nr; |
| 65 |
|
if (op == BS_ADD) |
| 66 |
|
complist[i].nr += clist[n].nr; |
| 67 |
|
else /* op == BS_ADJ */ |
| 68 |
|
complist[i].nr = clist[n].nr; |
| 69 |
|
clist[n].nr = 0; |
| 70 |
< |
clist[n].nc = 1; |
| 71 |
< |
lastin = -1; /* flag full sort */ |
| 70 |
> |
clist[n].nc = complist[i].nc; |
| 71 |
> |
if (complist[i].nr != oldnr) |
| 72 |
> |
lastin = -1; /* flag sort */ |
| 73 |
|
break; |
| 74 |
|
} |
| 75 |
< |
if (n >= nents) |
| 76 |
< |
clist[i].nc = bnrays(hdlist[clist[i].hd], |
| 77 |
< |
clist[i].bi); |
| 75 |
> |
if (i >= complen) |
| 76 |
> |
clist[n].nc = bnrays(hdlist[clist[n].hd], |
| 77 |
> |
clist[n].bi); |
| 78 |
|
} |
| 79 |
|
/* sort updated list */ |
| 80 |
|
sortcomplist(); |
| 149 |
|
for (i = 0; i < complen; i++) /* ...get number computed */ |
| 150 |
|
complist[i].nc = bnrays(hdlist[complist[i].hd], |
| 151 |
|
complist[i].bi); |
| 152 |
+ |
listpos = 0; |
| 153 |
+ |
lastin = -1; /* flag for initial sort */ |
| 154 |
|
} |
| 155 |
|
return; |
| 156 |
|
memerr: |
| 251 |
|
wtotal += complist[k++].nr; |
| 252 |
|
} |
| 253 |
|
/* adjust weights */ |
| 254 |
< |
if (vdef(DISKSPACE)) { |
| 254 |
> |
if (vdef(DISKSPACE)) |
| 255 |
|
frac = 1024.*1024.*vflt(DISKSPACE) / (wtotal*sizeof(RAYVAL)); |
| 256 |
< |
if (frac < 0.95 | frac > 1.05) |
| 257 |
< |
while (k--) |
| 258 |
< |
complist[k].nr = frac * complist[k].nr; |
| 259 |
< |
} |
| 256 |
> |
else |
| 257 |
> |
frac = 1024.*1024.*16384. / (wtotal*sizeof(RAYVAL)); |
| 258 |
> |
while (k--) |
| 259 |
> |
complist[k].nr = frac * complist[k].nr; |
| 260 |
|
listpos = 0; lastin = -1; /* flag initial sort */ |
| 261 |
|
} |
| 262 |
|
|