{"thread":{"id":"12127","subject":"[PATCH 1/6] diff.c: remove useless check for value != NULL","startedAt":"2008-02-16T04:59:53Z","lastAt":"2008-02-16T07:14:56Z","messageCount":2,"participants":["Christian Couder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"68866","messageId":"20080216055953.d5fafe10.chriscool@tuxfamily.org","threadId":"12127","inReplyTo":null,"subject":"[PATCH 1/6] diff.c: remove useless check for value != NULL","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2008-02-16T04:59:53Z","receivedAt":"2008-02-16T04:59:53Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"It is not necessary to check if value != NULL before calling\n'parse_lldiff_command' as there is already a check inside this\nfunction.\n\nBy the way this patch also improves the existing check inside\n'parse_lldiff_command' by using:\n\treturn config_error_nonbool(var);\ninstead of:\n\treturn error(\"%s: lacks value\", var);\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n diff.c |   11 +++--------\n 1 files changed, 3 insertions(+), 8 deletions(-)\n\n\tThis patch series can be applied on \"master\"\n\ton top of my \"diff.c: strdup -> xstrdup\" patch. \n\n\tThe first 3 patches apply cleanly on \"next\" though.\n\ndiff --git a/diff.c b/diff.c\nindex e5db293..5640cbf 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -87,7 +87,7 @@ static int parse_lldiff_command(const char *var, const char *ep, const char *val\n \t}\n \n \tif (!value)\n-\t\treturn error(\"%s: lacks value\", var);\n+\t\treturn config_error_nonbool(var);\n \tdrv->cmd = xstrdup(value);\n \treturn 0;\n }\n@@ -166,13 +166,8 @@ int git_diff_ui_config(const char *var, const char *value)\n \tif (!prefixcmp(var, \"diff.\")) {\n \t\tconst char *ep = strrchr(var, '.');\n \n-\t\tif (ep != var + 4) {\n-\t\t\tif (!strcmp(ep, \".command\")) {\n-\t\t\t\tif (!value)\n-\t\t\t\t\treturn config_error_nonbool(var);\n-\t\t\t\treturn parse_lldiff_command(var, ep, value);\n-\t\t\t}\n-\t\t}\n+\t\tif (ep != var + 4 && !strcmp(ep, \".command\"))\n+\t\t\treturn parse_lldiff_command(var, ep, value);\n \t}\n \n \treturn git_diff_basic_config(var, value);\n-- \n1.5.4.1.129.gf12af-dirty\n"},{"id":"68880","messageId":"7vejbdcqz3.fsf@gitster.siamese.dyndns.org","threadId":"12127","inReplyTo":"20080216055953.d5fafe10.chriscool@tuxfamily.org","subject":"Re: [PATCH 1/6] diff.c: remove useless check for value != NULL","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-16T07:14:56Z","receivedAt":"2008-02-16T07:14:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Couder <chriscool@tuxfamily.org> writes:\n\n> \tThis patch series can be applied on \"master\"\n> \ton top of my \"diff.c: strdup -> xstrdup\" patch. \n>\n> \tThe first 3 patches apply cleanly on \"next\" though.\n\nThey are all 'maint' material as far as I can tell ;-)\n\nThanks.\n"}]}