|
Lines 270-283
Link Here
|
| 270 |
channels = xcalloc(channels_alloc, sizeof(Channel *)); |
270 |
channels = xcalloc(channels_alloc, sizeof(Channel *)); |
| 271 |
for (i = 0; i < channels_alloc; i++) |
271 |
for (i = 0; i < channels_alloc; i++) |
| 272 |
channels[i] = NULL; |
272 |
channels[i] = NULL; |
|
|
273 |
found = 0; |
| 274 |
} |
| 275 |
else { |
| 276 |
/* Try to find a free slot where to put the new channel. */ |
| 277 |
for (found = -1, i = 1; i < channels_alloc; i++) |
| 278 |
if (channels[i] == NULL) { |
| 279 |
/* Found a free slot. */ |
| 280 |
found = (int)i; |
| 281 |
break; |
| 282 |
} |
| 273 |
} |
283 |
} |
| 274 |
/* Try to find a free slot where to put the new channel. */ |
|
|
| 275 |
for (found = -1, i = 0; i < channels_alloc; i++) |
| 276 |
if (channels[i] == NULL) { |
| 277 |
/* Found a free slot. */ |
| 278 |
found = (int)i; |
| 279 |
break; |
| 280 |
} |
| 281 |
if (found < 0) { |
284 |
if (found < 0) { |
| 282 |
/* There are no free slots. Take last+1 slot and expand the array. */ |
285 |
/* There are no free slots. Take last+1 slot and expand the array. */ |
| 283 |
found = channels_alloc; |
286 |
found = channels_alloc; |