| 384 | } |
| 385 | |
| 386 | struct _cmd_queue * |
| 387 | cmdq_copy(int q) |
| 388 | { |
| 389 | struct _cmd_queue *tmp = NULL; |
| 390 | struct _cmd_queue *cq = gc.command_queue[q]; |
| 391 | |
| 392 | while (cq) { |
| 393 | struct _cmd_queue *tmp2 = (struct _cmd_queue *) alloc(sizeof *tmp2); |
| 394 | |
| 395 | *tmp2 = *cq; |
| 396 | tmp2->next = tmp; |
| 397 | tmp = tmp2; |
| 398 | cq = cq->next; |
| 399 | } |
| 400 | |
| 401 | tmp = cmdq_reverse(tmp); |
| 402 | |
| 403 | return tmp; |
| 404 | } |
| 405 | |
| 406 | /* pop off the topmost command from the command queue. |
| 407 | * caller is responsible for freeing the returned _cmd_queue. |
no test coverage detected