{"thread":{"id":"29026","subject":"[PATCH] Remove redundant assignments","startedAt":"2011-11-27T08:05:42Z","lastAt":"2011-11-27T08:26:45Z","messageCount":2,"participants":["Jan Stępień","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"180001","messageId":"1322381142-20645-1-git-send-email-jstepien@users.sourceforge.net","threadId":"29026","inReplyTo":null,"subject":"[PATCH] Remove redundant assignments","fromName":"Jan Stępień","fromEmail":"jstepien@users.sourceforge.net","sentAt":"2011-11-27T08:05:42Z","receivedAt":"2011-11-27T08:05:42Z","isPatch":true,"sender":{"key":"jstepien@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/39084?v=4"},"body":"There were two redundant variable assignments in transport.c and\nwt-status.c. Removing them hasn't introduced any compiler warnings or\nregressions.\n\nSigned-off-by: Jan Stępień <jstepien@users.sourceforge.net>\n---\n transport.c |    2 +-\n wt-status.c |    2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/transport.c b/transport.c\nindex 51814b5..5143718 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -105,7 +105,7 @@ static void insert_packed_refs(const char *packed_refs, struct ref **list)\n \t\treturn;\n \n \tfor (;;) {\n-\t\tint cmp = cmp, len;\n+\t\tint cmp, len;\n \n \t\tif (!fgets(buffer, sizeof(buffer), f)) {\n \t\t\tfclose(f);\ndiff --git a/wt-status.c b/wt-status.c\nindex 70fdb76..35f61f4 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -229,7 +229,7 @@ static void wt_status_print_change_data(struct wt_status *s,\n {\n \tstruct wt_status_change_data *d = it->util;\n \tconst char *c = color(change_type, s);\n-\tint status = status;\n+\tint status;\n \tchar *one_name;\n \tchar *two_name;\n \tconst char *one, *two;\n-- \n1.7.7.4\n"},{"id":"180002","messageId":"7vfwhavum2.fsf@alter.siamese.dyndns.org","threadId":"29026","inReplyTo":"1322381142-20645-1-git-send-email-jstepien@users.sourceforge.net","subject":"Re: [PATCH] Remove redundant assignments","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-11-27T08:26:45Z","receivedAt":"2011-11-27T08:26:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jan Stępień  <jstepien@users.sourceforge.net> writes:\n\n> There were two redundant variable assignments in transport.c and\n> wt-status.c. Removing them hasn't introduced any compiler warnings or\n> regressions.\n\nIt may not have added any warnings for _you_.\n\nThese \"type a = a;\" initializations (they are not even assignments and\nwould not result in any code in the output for sane compilers) are idioms\nto squelch \"unused\" warnings from versions of compiler whose data flow\nanalysis is less than perfect by telling them that the author of the\nsection of the code knows what s/he is doing.\n\nAt least, that is why these pseudo initializations were added in these\ncodepaths. I personally feel that they should be made into useless but\nreal assignments (which may result in a useless assignment emited in the\nresulting object code) rather than removing like your patch did which\nunfortunately forces people with imperfect compilers to live with the\nwarnings, if one finds them ugly.\n\n> Signed-off-by: Jan Stępień <jstepien@users.sourceforge.net>\n> ---\n>  transport.c |    2 +-\n>  wt-status.c |    2 +-\n>  2 files changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/transport.c b/transport.c\n> index 51814b5..5143718 100644\n> --- a/transport.c\n> +++ b/transport.c\n> @@ -105,7 +105,7 @@ static void insert_packed_refs(const char *packed_refs, struct ref **list)\n>  \t\treturn;\n>  \n>  \tfor (;;) {\n> -\t\tint cmp = cmp, len;\n> +\t\tint cmp, len;\n>  \n>  \t\tif (!fgets(buffer, sizeof(buffer), f)) {\n>  \t\t\tfclose(f);\n> diff --git a/wt-status.c b/wt-status.c\n> index 70fdb76..35f61f4 100644\n> --- a/wt-status.c\n> +++ b/wt-status.c\n> @@ -229,7 +229,7 @@ static void wt_status_print_change_data(struct wt_status *s,\n>  {\n>  \tstruct wt_status_change_data *d = it->util;\n>  \tconst char *c = color(change_type, s);\n> -\tint status = status;\n> +\tint status;\n>  \tchar *one_name;\n>  \tchar *two_name;\n>  \tconst char *one, *two;\n"}]}