threads / patch / 40467

patchsubmodule-parallel-fetch: make some file local symbols static

Subject: [PATCH] submodule-parallel-fetch: make some file local symbols static

## tl;dr

4 messages between Oct 1, 2015 and Oct 2, 2015. Diffs are folded; open one to read it.

replies: 3people: 3as markdown or json

Ramsay Jones· Oct 1, 2015, 12:02 UTC · lore

Commits 0fc1fdb0 ("fetch_populated_submodules: use new parallel job processing", 28-09-2015) and 60f24f52 ("run-command: add an asynchronous parallel child processor", 28-09-2015) both introduce external symbols which only require file scope visibility. In order to reduce the visibility, apply the static keyword to their declarations.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
Hi Stefan,

No, despite the same subject, this is not the same patch that I sent you last week! :-D

Could you please squash parts of this into the patches corresponding to the above mentioned commits.

Thanks!

BTW, I would once again suggest that you could move the definition of get_next_submodule() to be above/before fetch_populated_submodules() so that you can remove the forward declaration.

ATB, Ramsay Jones

 run-command.c | 2 +-
 submodule.c   | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
Show changes to 2 files +5 −5

run-command.c, submodule.c

diff --git a/run-command.c b/run-command.c
index 341b23b..347d22e 100644
--- a/run-command.c
+++ b/run-command.c
@@ -865,7 +865,7 @@ int capture_command(struct child_process *cmd, struct strbuf *buf, size_t hint)
 	return finish_command(cmd);
 }
 
-struct parallel_processes {
+static struct parallel_processes {
 	void *data;
 
 	int max_processes;
diff --git a/submodule.c b/submodule.c
index bd6e208..638efb5 100644
--- a/submodule.c
+++ b/submodule.c
@@ -622,8 +622,8 @@ struct submodule_parallel_fetch {
 };
 #define SPF_INIT {0, ARGV_ARRAY_INIT, NULL, NULL, 0, 0, 0}
 
-int get_next_submodule(void *data, struct child_process *cp,
-		       struct strbuf *err);
+static int get_next_submodule(void *data, struct child_process *cp,
+			      struct strbuf *err);
 
 static int fetch_start_failure(void *data, struct child_process *cp,
 			       struct strbuf *err)
@@ -682,8 +682,8 @@ out:
 	return spf.result;
 }
 
-int get_next_submodule(void *data, struct child_process *cp,
-		       struct strbuf *err)
+static int get_next_submodule(void *data, struct child_process *cp,
+			      struct strbuf *err)
 {
 	int ret = 0;
 	struct submodule_parallel_fetch *spf = data;
-- 
2.6.0
Stefan Beller· Oct 1, 2015, 17:05 UTC · re: Ramsay Jones · lore

Re: [PATCH] submodule-parallel-fetch: make some file local symbols static

On Thu, Oct 1, 2015 at 5:02 AM, Ramsay Jones <ramsay@ramsayjones.plus.com> wrote:

Show 17 quoted lines
>
> Commits 0fc1fdb0 ("fetch_populated_submodules: use new parallel job
> processing", 28-09-2015) and 60f24f52 ("run-command: add an asynchronous
> parallel child processor", 28-09-2015) both introduce external symbols
> which only require file scope visibility. In order to reduce the
> visibility, apply the static keyword to their declarations.
>
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
>
> Hi Stefan,
>
> No, despite the same subject, this is not the same patch that I sent
> you last week! :-D
>
> Could you please squash parts of this into the patches corresponding
> to the above mentioned commits.
I am sorry for the need to send this second patch. :(
Show 24 quoted lines
>
> Thanks!
>
> BTW, I would once again suggest that you could move the definition of
> get_next_submodule() to be above/before fetch_populated_submodules()
> so that you can remove the forward declaration.
>
> ATB,
> Ramsay Jones
>
>  run-command.c | 2 +-
>  submodule.c   | 8 ++++----
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/run-command.c b/run-command.c
> index 341b23b..347d22e 100644
> --- a/run-command.c
> +++ b/run-command.c
> @@ -865,7 +865,7 @@ int capture_command(struct child_process *cmd, struct strbuf *buf, size_t hint)
>         return finish_command(cmd);
>  }
>
> -struct parallel_processes {
> +static struct parallel_processes {
will pickup in a reroll
Show 15 quoted lines
>         void *data;
>
>         int max_processes;
> diff --git a/submodule.c b/submodule.c
> index bd6e208..638efb5 100644
> --- a/submodule.c
> +++ b/submodule.c
> @@ -622,8 +622,8 @@ struct submodule_parallel_fetch {
>  };
>  #define SPF_INIT {0, ARGV_ARRAY_INIT, NULL, NULL, 0, 0, 0}
>
> -int get_next_submodule(void *data, struct child_process *cp,
> -                      struct strbuf *err);
> +static int get_next_submodule(void *data, struct child_process *cp,
> +                             struct strbuf *err);

I thought I had this in yesterdays reroll (v6). Oh you're referring to the version from the 28th (I forgot to label them v5 I suppose).

I will also get rid of the forward declaration.
Show 20 quoted lines
>
>  static int fetch_start_failure(void *data, struct child_process *cp,
>                                struct strbuf *err)
> @@ -682,8 +682,8 @@ out:
>         return spf.result;
>  }
>
> -int get_next_submodule(void *data, struct child_process *cp,
> -                      struct strbuf *err)
> +static int get_next_submodule(void *data, struct child_process *cp,
> +                             struct strbuf *err)
>  {
>         int ret = 0;
>         struct submodule_parallel_fetch *spf = data;
> --
> 2.6.0
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ramsay Jones· Oct 1, 2015, 18:43 UTC · re: Stefan Beller · lore

Re: [PATCH] submodule-parallel-fetch: make some file local symbols static

On 01/10/15 18:05, Stefan Beller wrote:
> On Thu, Oct 1, 2015 at 5:02 AM, Ramsay Jones
> <ramsay@ramsayjones.plus.com> wrote:
>>
[snip]
Show 12 quoted lines
>> diff --git a/run-command.c b/run-command.c
>> index 341b23b..347d22e 100644
>> --- a/run-command.c
>> +++ b/run-command.c
>> @@ -865,7 +865,7 @@ int capture_command(struct child_process *cmd, struct strbuf *buf, size_t hint)
>>         return finish_command(cmd);
>>  }
>>
>> -struct parallel_processes {
>> +static struct parallel_processes {
> 
> will pickup in a reroll
Thanks
Show 20 quoted lines
> 
>>         void *data;
>>
>>         int max_processes;
>> diff --git a/submodule.c b/submodule.c
>> index bd6e208..638efb5 100644
>> --- a/submodule.c
>> +++ b/submodule.c
>> @@ -622,8 +622,8 @@ struct submodule_parallel_fetch {
>>  };
>>  #define SPF_INIT {0, ARGV_ARRAY_INIT, NULL, NULL, 0, 0, 0}
>>
>> -int get_next_submodule(void *data, struct child_process *cp,
>> -                      struct strbuf *err);
>> +static int get_next_submodule(void *data, struct child_process *cp,
>> +                             struct strbuf *err);
> 
> I thought I had this in yesterdays reroll (v6). Oh you're referring to
> the version
> from the 28th (I forgot to label them v5 I suppose).

Ah! I thought I'd seen it on the list. (I thought I was going crazy) ;-) Sorry, my fault. I just assumed that today's pu branch would have your latest patches - I didn't actually check that.

Note that the first hunk, above, is actually new (I hadn't noticed it before).

> 
> I will also get rid of the forward declaration.
Thanks!

ATB, Ramsay Jones

Show 16 quoted lines
> 
>>
>>  static int fetch_start_failure(void *data, struct child_process *cp,
>>                                struct strbuf *err)
>> @@ -682,8 +682,8 @@ out:
>>         return spf.result;
>>  }
>>
>> -int get_next_submodule(void *data, struct child_process *cp,
>> -                      struct strbuf *err)
>> +static int get_next_submodule(void *data, struct child_process *cp,
>> +                             struct strbuf *err)
>>  {
>>         int ret = 0;
>>         struct submodule_parallel_fetch *spf = data;
>> --
Junio C Hamano· Oct 2, 2015, 17:45 UTC · re: Ramsay Jones · lore

Re: [PATCH] submodule-parallel-fetch: make some file local symbols static

Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
Show 7 quoted lines
>> I thought I had this in yesterdays reroll (v6). Oh you're referring to
>> the version
>> from the 28th (I forgot to label them v5 I suppose).
>
> Ah! I thought I'd seen it on the list. (I thought I was going crazy) ;-)
> Sorry, my fault. I just assumed that today's pu branch would have your
> latest patches - I didn't actually check that.
Sometimes I take a one-day vacation ;-)
Thanks.

← back to recent threads