MCPcopy Create free account
hub / github.com/NetHack/NetHack / cmdq_copy

Function cmdq_copy

src/cmd.c:386–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384}
385
386struct _cmd_queue *
387cmdq_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.

Callers 1

do_repeatFunction · 0.85

Calls 2

cmdq_reverseFunction · 0.85
allocFunction · 0.70

Tested by

no test coverage detected