{"thread":{"id":"7661","subject":"[PATCH 01/02] ident.c: Use const qualifier when possible","startedAt":"2007-04-15T18:51:10Z","lastAt":"2007-04-15T21:40:31Z","messageCount":4,"participants":["Luiz Fernando N. Capitulino","Andy Parkins","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"39379","messageId":"20070415155110.365070d8@gnut","threadId":"7661","inReplyTo":null,"subject":"[PATCH 01/02] ident.c: Use const qualifier when possible","fromName":"Luiz Fernando N. Capitulino","fromEmail":"lcapitulino@mandriva.com.br","sentAt":"2007-04-15T18:51:10Z","receivedAt":"2007-04-15T18:51:10Z","isPatch":true,"sender":{"key":"lcapitulino@mandriva.com.br","avatar":null},"body":"\nSigned-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>\n---\n ident.c |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/ident.c b/ident.c\nindex bb03bdd..454aace 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -9,7 +9,7 @@\n \n static char git_default_date[50];\n \n-static void copy_gecos(struct passwd *w, char *name, int sz)\n+static void copy_gecos(const struct passwd *w, char *name, int sz)\n {\n \tchar *src, *dst;\n \tint len, nlen;\n@@ -43,7 +43,7 @@ static void copy_gecos(struct passwd *w, char *name, int sz)\n \n }\n \n-static void copy_email(struct passwd *pw)\n+static void copy_email(const struct passwd *pw)\n {\n \t/*\n \t * Make up a fake email address\n@@ -172,7 +172,7 @@ static int copy(char *buf, int size, int offset, const char *src)\n \n static const char au_env[] = \"GIT_AUTHOR_NAME\";\n static const char co_env[] = \"GIT_COMMITTER_NAME\";\n-static const char *env_hint =\n+static const char const *env_hint =\n \"\\n\"\n \"*** Your name cannot be determined from your system services (gecos).\\n\"\n \"\\n\"\n-- \n1.5.1.1.86.gfd56-dirty\n"},{"id":"39389","messageId":"200704152106.51082.andyparkins@gmail.com","threadId":"7661","inReplyTo":"20070415155110.365070d8@gnut","subject":"Re: [PATCH 01/02] ident.c: Use const qualifier when possible","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2007-04-15T20:06:49Z","receivedAt":"2007-04-15T20:06:49Z","isPatch":true,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"On Sunday 2007, April 15, Luiz Fernando N. Capitulino wrote:\n\n> -static const char *env_hint =\n> +static const char const *env_hint =\n\n char c;              // c is a char\n char *p;             // p is a pointer, *p is a char\n const char c;        // c is a const char  [1]\n char const c;        // c is a const char  [1]\n const char *p;       // p is a pointer, *p is a const char [2]\n char const *p;       // p is a pointer, *p is a const char [2]\n char *const p;       // p is a const-pointer, *p is a char\n const char *const p; // p is a const-pointer, *p is a const-char\n\n[1] Semantically identical\n[2] Semantically identical\n\nYou can see then that\n\n const char const *env_hint\n\nis redundant, it's simply saying twice that (*env_hint) is const.\n\n\nAndy\n-- \nDr Andy Parkins, M Eng (hons), MIET\nandyparkins@gmail.com\n"},{"id":"39391","messageId":"7vslb12y4e.fsf@assigned-by-dhcp.cox.net","threadId":"7661","inReplyTo":"200704152106.51082.andyparkins@gmail.com","subject":"Re: [PATCH 01/02] ident.c: Use const qualifier when possible","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-15T20:14:57Z","receivedAt":"2007-04-15T20:14:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andy Parkins <andyparkins@gmail.com> writes:\n\n> On Sunday 2007, April 15, Luiz Fernando N. Capitulino wrote:\n>\n>> -static const char *env_hint =\n>> +static const char const *env_hint =\n>\n> You can see then that\n>\n>  const char const *env_hint\n>\n> is redundant, it's simply saying twice that (*env_hint) is const.\n\nI think he wanted to say\n\n\tstatic const char *const env_hint = ...\n"},{"id":"39408","messageId":"20070415184031.2df65364@gnut","threadId":"7661","inReplyTo":"7vslb12y4e.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 01/02] ident.c: Use const qualifier when possible","fromName":"Luiz Fernando N. Capitulino","fromEmail":"lcapitulino@mandriva.com.br","sentAt":"2007-04-15T21:40:31Z","receivedAt":"2007-04-15T21:40:31Z","isPatch":true,"sender":{"key":"lcapitulino@mandriva.com.br","avatar":null},"body":"Em Sun, 15 Apr 2007 13:14:57 -0700\nJunio C Hamano <junkio@cox.net> escreveu:\n\n| Andy Parkins <andyparkins@gmail.com> writes:\n| \n| > On Sunday 2007, April 15, Luiz Fernando N. Capitulino wrote:\n| >\n| >> -static const char *env_hint =\n| >> +static const char const *env_hint =\n| >\n| > You can see then that\n| >\n| >  const char const *env_hint\n| >\n| > is redundant, it's simply saying twice that (*env_hint) is const.\n| \n| I think he wanted to say\n| \n| \tstatic const char *const env_hint = ...\n\n Urgh, yes. And it's not possible to make the pointer const\nbecause we change the value it points to (-2 for me).\n\n Updated version follows. I don't need to send the second\nagain, right?\n\nFrom: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>\nSubject: [PATCH] ident.c: Use const qualifier for 'struct passwd' parameters\n\nSigned-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>\n---\n ident.c |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/ident.c b/ident.c\nindex bb03bdd..b557ecd 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -9,7 +9,7 @@\n \n static char git_default_date[50];\n \n-static void copy_gecos(struct passwd *w, char *name, int sz)\n+static void copy_gecos(const struct passwd *w, char *name, int sz)\n {\n \tchar *src, *dst;\n \tint len, nlen;\n@@ -43,7 +43,7 @@ static void copy_gecos(struct passwd *w, char *name, int sz)\n \n }\n \n-static void copy_email(struct passwd *pw)\n+static void copy_email(const struct passwd *pw)\n {\n \t/*\n \t * Make up a fake email address\n-- \n1.5.1.1.86.gfd56-dirty\n"}]}