Andy Parkins [off-list ref] writes:
On Sunday 2007, April 15, Luiz Fernando N. Capitulino wrote:
quoted
-static const char *env_hint =
+static const char const *env_hint =
You can see then that
const char const *env_hint
is redundant, it's simply saying twice that (*env_hint) is const.
I think he wanted to say
static const char *const env_hint = ...
Em Sun, 15 Apr 2007 13:14:57 -0700
Junio C Hamano [off-list ref] escreveu:
| Andy Parkins [off-list ref] writes:
|
| > On Sunday 2007, April 15, Luiz Fernando N. Capitulino wrote:
| >
| >> -static const char *env_hint =
| >> +static const char const *env_hint =
| >
| > You can see then that
| >
| > const char const *env_hint
| >
| > is redundant, it's simply saying twice that (*env_hint) is const.
|
| I think he wanted to say
|
| static const char *const env_hint = ...
Urgh, yes. And it's not possible to make the pointer const
because we change the value it points to (-2 for me).
Updated version follows. I don't need to send the second
again, right?
From: Luiz Fernando N. Capitulino <redacted>
Subject: [PATCH] ident.c: Use const qualifier for 'struct passwd' parameters
Signed-off-by: Luiz Fernando N. Capitulino <redacted>
---
ident.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ident.c b/ident.c
index bb03bdd..b557ecd 100644
--- a/ident.c
+++ b/ident.c
@@ -9,7 +9,7 @@
static char git_default_date[50];
-static void copy_gecos(struct passwd *w, char *name, int sz)
+static void copy_gecos(const struct passwd *w, char *name, int sz)
{
char *src, *dst;
int len, nlen;@@ -43,7 +43,7 @@ static void copy_gecos(struct passwd *w, char *name, int sz)
}
-static void copy_email(struct passwd *pw)
+static void copy_email(const struct passwd *pw)
{
/*
* Make up a fake email address--
1.5.1.1.86.gfd56-dirty