Store *xalp on the end of rsync_xal_l */
| 451 | |
| 452 | /* Store *xalp on the end of rsync_xal_l */ |
| 453 | static int rsync_xal_store(item_list *xalp) |
| 454 | { |
| 455 | struct ht_int64_node *node; |
| 456 | int ndx = rsync_xal_l.count; /* pre-incremented count */ |
| 457 | rsync_xa_list *new_list = EXPAND_ITEM_LIST(&rsync_xal_l, rsync_xa_list, RSYNC_XAL_LIST_INITIAL); |
| 458 | rsync_xa_list_ref *new_ref; |
| 459 | /* Since the following call starts a new list, we know it will hold the |
| 460 | * entire initial-count, not just enough space for one new item. */ |
| 461 | *new_list = empty_xa_list; |
| 462 | (void)EXPAND_ITEM_LIST(&new_list->xa_items, rsync_xa, xalp->count); |
| 463 | memcpy(new_list->xa_items.items, xalp->items, xalp->count * sizeof (rsync_xa)); |
| 464 | new_list->xa_items.count = xalp->count; |
| 465 | xalp->count = 0; |
| 466 | |
| 467 | new_list->ndx = ndx; |
| 468 | new_list->key = xattr_lookup_hash(&new_list->xa_items); |
| 469 | |
| 470 | if (rsync_xal_h == NULL) |
| 471 | rsync_xal_h = hashtable_create(512, HT_KEY64); |
| 472 | |
| 473 | new_ref = new0(rsync_xa_list_ref); |
| 474 | new_ref->ndx = ndx; |
| 475 | |
| 476 | node = hashtable_find(rsync_xal_h, new_list->key, new_ref); |
| 477 | if (node->data != (void*)new_ref) { |
| 478 | rsync_xa_list_ref *ref = node->data; |
| 479 | |
| 480 | while (ref != NULL) { |
| 481 | if (ref->next != NULL) { |
| 482 | ref = ref->next; |
| 483 | continue; |
| 484 | } |
| 485 | |
| 486 | ref->next = new_ref; |
| 487 | break; |
| 488 | } |
| 489 | } |
| 490 | |
| 491 | return ndx; |
| 492 | } |
| 493 | |
| 494 | /* Send the make_xattr()-generated xattr list for this flist entry. */ |
| 495 | int send_xattr(int f, stat_x *sxp) |
no test coverage detected