Re: [PATCH v2 4/8] merge-ort: introduce wrappers for alternate tree traversal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/8/2021 7:09 PM, Elijah Newren via GitGitGadget wrote:
> From: Elijah Newren <newren@xxxxxxxxx>
> 
> Add traverse_trees_wrapper() and traverse_trees_wrapper_callback()
> functions.  The former runs traverse_trees() with info->fn set to
> traverse_trees_wrapper_callback, in order to simply save all the entries
> without processing or recursing into any of them.  This step allows
> extra computation to be done (e.g. checking some condition across all
> files) that can be used later.  Then, after that is completed, it
> iterates over all the saved entries and calls the original info->fn
> callback with the saved data.
> 
> Currently, this does nothing more than marginally slowing down the tree
> traversal since we do not take advantage of the opportunity to compute
> anything special in traverse_trees_wrapper_callback(), and thus the real
> callback will be called identically as it would have been without this
> extra wrapper.  However, a subsequent commit will add some special
> computation of some values that the real callback will be able to use.

I'm glad that you use the normal callback in the appropriate case.

It took me a couple reads to understand this last sentence, but I think
I'm with you now.

> +	info->traverse_path = renames->callback_data_traverse_path;
> +	info->fn = old_fn;
> +	for (i = old_offset; i < renames->callback_data_nr; ++i) {
> +		info->fn(n,
> +			 renames->callback_data[i].mask,
> +			 renames->callback_data[i].dirmask,
> +			 renames->callback_data[i].names,
> +			 info);
> +

nit: extraneous newline.

Thanks,
-Stolee



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux