MCPcopy Create free account
hub / github.com/OpenPrinting/cups / httpAddrCopyList

Function httpAddrCopyList

cups/http-addrlist.c:441–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

439 */
440
441http_addrlist_t * /* O - New address list or @code NULL@ on error */
442httpAddrCopyList(
443 http_addrlist_t *src) /* I - Source address list */
444{
445 http_addrlist_t *dst = NULL, /* First list entry */
446 *prev = NULL, /* Previous list entry */
447 *current = NULL;/* Current list entry */
448
449
450 while (src)
451 {
452 if ((current = malloc(sizeof(http_addrlist_t))) == NULL)
453 {
454 current = dst;
455
456 while (current)
457 {
458 prev = current;
459 current = current->next;
460
461 free(prev);
462 }
463
464 return (NULL);
465 }
466
467 memcpy(current, src, sizeof(http_addrlist_t));
468
469 current->next = NULL;
470
471 if (prev)
472 prev->next = current;
473 else
474 dst = current;
475
476 prev = current;
477 src = src->next;
478 }
479
480 return (dst);
481}
482
483
484/*

Callers 1

http_createFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected