diff mbox series

[1/5] serve: mark has_capability() as static

Message ID patch-1.5-4f74d7d34c4-20210616T141332Z-avarab@gmail.com (mailing list archive)
State New, archived
Headers show
Series serve: add "configure" callback | expand

Commit Message

Ævar Arnfjörð Bjarmason June 16, 2021, 2:16 p.m. UTC
The has_capability() function introduced in ed10cb952d3 (serve:
introduce git-serve, 2018-03-15) has never been used anywhere except
serve.c, so let's mark it as static.

It was later changed from "extern" in 554544276a6 (*.[ch]: remove
extern from function declarations using spatch, 2019-04-29), but we
could have simply marked it as "static" instead.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 serve.c | 4 ++--
 serve.h | 3 ---
 2 files changed, 2 insertions(+), 5 deletions(-)

Comments

Eric Sunshine June 16, 2021, 4:28 p.m. UTC | #1
On Wed, Jun 16, 2021 at 10:16 AM Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
> The has_capability() function introduced in ed10cb952d3 (serve:
> introduce git-serve, 2018-03-15) has never been used anywhere except
> serve.c, so let's mark it as static.
>
> It was later changed from "extern" in 554544276a6 (*.[ch]: remove
> extern from function declarations using spatch, 2019-04-29), but we
> could have simply marked it as "static" instead.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
> diff --git a/serve.h b/serve.h
> @@ -2,9 +2,6 @@
>  struct strvec;
> -int has_capability(const struct strvec *keys, const char *capability,
> -                  const char **value);
> -

`strvec` isn't used anywhere in this header following removal of
has_capability(), so the forward declaration could be dropped, as
well.
Junio C Hamano June 17, 2021, 12:45 a.m. UTC | #2
Eric Sunshine <sunshine@sunshineco.com> writes:

> On Wed, Jun 16, 2021 at 10:16 AM Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> wrote:
>> The has_capability() function introduced in ed10cb952d3 (serve:
>> introduce git-serve, 2018-03-15) has never been used anywhere except
>> serve.c, so let's mark it as static.
>>
>> It was later changed from "extern" in 554544276a6 (*.[ch]: remove
>> extern from function declarations using spatch, 2019-04-29), but we
>> could have simply marked it as "static" instead.
>>
>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
>> ---
>> diff --git a/serve.h b/serve.h
>> @@ -2,9 +2,6 @@
>>  struct strvec;
>> -int has_capability(const struct strvec *keys, const char *capability,
>> -                  const char **value);
>> -
>
> `strvec` isn't used anywhere in this header following removal of
> has_capability(), so the forward declaration could be dropped, as
> well.

Good eyes.
diff mbox series

Patch

diff --git a/serve.c b/serve.c
index aa8209f147e..6748c590b74 100644
--- a/serve.c
+++ b/serve.c
@@ -156,8 +156,8 @@  static int is_command(const char *key, struct protocol_capability **command)
 	return 0;
 }
 
-int has_capability(const struct strvec *keys, const char *capability,
-		   const char **value)
+static int has_capability(const struct strvec *keys, const char *capability,
+			  const char **value)
 {
 	int i;
 	for (i = 0; i < keys->nr; i++) {
diff --git a/serve.h b/serve.h
index fc2683e24d3..b31dd69434b 100644
--- a/serve.h
+++ b/serve.h
@@ -2,9 +2,6 @@ 
 #define SERVE_H
 
 struct strvec;
-int has_capability(const struct strvec *keys, const char *capability,
-		   const char **value);
-
 struct serve_options {
 	unsigned advertise_capabilities;
 	unsigned stateless_rpc;