116 |
|
default: |
117 |
|
error(CONSISTENCY, "bundle_set called with unknown operation"); |
118 |
|
} |
119 |
< |
n = 0; /* allocate packet holder */ |
120 |
< |
for (i = 0; i < nents; i++) |
121 |
< |
if (clist[i].nr > n) |
122 |
< |
n = clist[i].nr; |
123 |
< |
p = (PACKHEAD *)malloc(sizeof(PACKHEAD) + n*sizeof(RAYVAL)); |
119 |
> |
if (outdev == NULL) |
120 |
> |
return; |
121 |
> |
n = 8*RPACKSIZ; /* allocate packet holder */ |
122 |
> |
p = (PACKHEAD *)malloc(packsiz(n)); |
123 |
|
if (p == NULL) |
124 |
|
goto memerr; |
125 |
|
/* display what we have */ |
126 |
|
for (i = 0; i < nents; i++) |
127 |
|
if ((b = hdgetbeam(hdlist[clist[i].hd], clist[i].bi)) != NULL) { |
128 |
< |
bcopy((char *)hdbray(b), (char *)(p+1), |
128 |
> |
if (b->nrm > n) { |
129 |
> |
n = b->nrm; |
130 |
> |
p = (PACKHEAD *)realloc((char *)p, packsiz(n)); |
131 |
> |
if (p == NULL) |
132 |
> |
goto memerr; |
133 |
> |
} |
134 |
> |
bcopy((char *)hdbray(b), (char *)packra(p), |
135 |
|
(p->nr=b->nrm)*sizeof(RAYVAL)); |
136 |
< |
disp_packet((PACKET *)p); |
136 |
> |
p->hd = clist[i].hd; |
137 |
> |
p->bi = clist[i].bi; |
138 |
> |
disp_packet(p); |
139 |
|
} |
140 |
|
free((char *)p); /* clean up */ |
141 |
|
return; |
279 |
|
done_packets(flush_queue()); |
280 |
|
if (complen <= 0) /* check to see if there is even a list */ |
281 |
|
return; |
282 |
< |
if (lastin < 0) /* flag to sort entire list */ |
282 |
> |
if (lastin < 0 || listpos*4 >= complen*3) |
283 |
|
qsort((char *)complist, complen, sizeof(PACKHEAD), beamcmp); |
284 |
|
else if (listpos) { /* else sort and merge sublist */ |
285 |
|
list2 = (PACKHEAD *)malloc(listpos*sizeof(PACKHEAD)); |