MCPcopy Create free account
hub / github.com/RsyncProject/rsync / add_dirs_to_tree

Function add_dirs_to_tree

flist.c:1799–1836  ·  view source on GitHub ↗

We take an entire set of sibling dirs from the sorted flist and link them * into the tree, setting the appropriate parent/child/sibling pointers. */

Source from the content-addressed store, hash-verified

1797/* We take an entire set of sibling dirs from the sorted flist and link them
1798 * into the tree, setting the appropriate parent/child/sibling pointers. */
1799static void add_dirs_to_tree(int parent_ndx, struct file_list *from_flist,
1800 int dir_cnt)
1801{
1802 int i;
1803 int32 *dp = NULL;
1804 int32 *parent_dp = parent_ndx < 0 ? NULL
1805 : F_DIR_NODE_P(dir_flist->sorted[parent_ndx]);
1806
1807 /* The sending side is adding entries to dir_flist in sorted order, so sorted & files are the same. */
1808 flist_expand(dir_flist, dir_cnt);
1809 dir_flist->sorted = dir_flist->files;
1810
1811 for (i = 0; dir_cnt; i++) {
1812 struct file_struct *file = from_flist->sorted[i];
1813
1814 if (!S_ISDIR(file->mode))
1815 continue;
1816
1817 dir_flist->files[dir_flist->used++] = file;
1818 dir_cnt--;
1819
1820 if (file->basename[0] == '.' && file->basename[1] == '\0')
1821 continue;
1822
1823 if (dp)
1824 DIR_NEXT_SIBLING(dp) = dir_flist->used - 1;
1825 else if (parent_dp)
1826 DIR_FIRST_CHILD(parent_dp) = dir_flist->used - 1;
1827 else
1828 send_dir_ndx = dir_flist->used - 1;
1829
1830 dp = F_DIR_NODE_P(file);
1831 DIR_PARENT(dp) = parent_ndx;
1832 DIR_FIRST_CHILD(dp) = -1;
1833 }
1834 if (dp)
1835 DIR_NEXT_SIBLING(dp) = -1;
1836}
1837
1838static void interpret_stat_error(const char *fname, int is_dir)
1839{

Callers 2

send_extra_file_listFunction · 0.85
send_file_listFunction · 0.85

Calls 1

flist_expandFunction · 0.85

Tested by

no test coverage detected