git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/1] submodule--helper.c: Rename 'cb_foreach' to 'foreach_cb'

From
Derrick Stolee <stolee@gmail.com>
Date
Mar 18, 2020, 10:57 UTC
Message-ID
<f6ea8357-a5c3-169c-b3c6-9d1726e65859@gmail.com>
In-Reply-To
<20200318095842.27679-2-shouryashukla.oo@gmail.com>
On 3/18/2020 5:58 AM, Shourya Shukla wrote:
Show 8 quoted lines
> In 'submodule--helper.c', the structures and macros for callbacks belonging
> to any subcommand are named in the format: 'subcommand_cb' and 'SUBCOMMAND_CB_INIT'
> respectively.
> 
> This was an exception for the subcommand 'foreach' of the command
> 'submodule'. Rename the aforementioned structures and macros:
> 'struct foreach_cb' to 'struct cb_foreach' and 'CB_FOREACH_INIT'
> to 'FOREACH_CB_INIT'.
I believe your "<before> to <after>" statements are reversed.
Show 40 quoted lines
> Signed-off-by: Shourya Shukla <shouryashukla.oo@gmail.com>
> ---
>  builtin/submodule--helper.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
> index 86a608eec1..1a4b391c88 100644
> --- a/builtin/submodule--helper.c
> +++ b/builtin/submodule--helper.c
> @@ -444,19 +444,19 @@ static void for_each_listed_submodule(const struct module_list *list,
>  		fn(list->entries[i], cb_data);
>  }
>  
> -struct cb_foreach {
> +struct foreach_cb {
>  	int argc;
>  	const char **argv;
>  	const char *prefix;
>  	int quiet;
>  	int recursive;
>  };
> -#define CB_FOREACH_INIT { 0 }
> +#define FOREACH_CB_INIT { 0 }
>  
>  static void runcommand_in_submodule_cb(const struct cache_entry *list_item,
>  				       void *cb_data)
>  {
> -	struct cb_foreach *info = cb_data;
> +	struct foreach_cb *info = cb_data;
>  	const char *path = list_item->name;
>  	const struct object_id *ce_oid = &list_item->oid;
>  
> @@ -557,7 +557,7 @@ static void runcommand_in_submodule_cb(const struct cache_entry *list_item,
>  
>  static int module_foreach(int argc, const char **argv, const char *prefix)
>  {
> -	struct cb_foreach info = CB_FOREACH_INIT;
> +	struct foreach_cb info = FOREACH_CB_INIT;
>  	struct pathspec pathspec;
>  	struct module_list list = MODULE_LIST_INIT;

Based on the description, I was worried this patch would be very large. The fact that the change is so small makes this reasonable in isolation.

Thanks, -Stolee

Previous: Shourya ShuklaNext: Shourya Shukla
Message 3 of 5 in “submodule--helper.c: Rename 'cb_foreach' to 'foreach_cb'”
  1. 0/1 submodule--helper.c: Rename 'cb_foreach' to 'foreach_cb'Shourya Shukla, Mar 18, 2020
  2. 1/1 submodule--helper.c: Rename 'cb_foreach' to 'foreach_cb'Shourya Shukla, Mar 18, 2020
  3. Derrick StoleeMar 18, 2020
  4. 0/1 submodule--helper.c: Rename 'cb_foreach' to 'foreach_cb'Shourya Shukla, Mar 18, 2020
  5. 1/1 submodule--helper.c: Rename 'cb_foreach' to 'foreach_cb'Shourya Shukla, Mar 18, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.