{"thread":{"id":"31437","subject":"[PATCH 3/3] read-cache.c: Simplify do loop conditional expression","startedAt":"2012-09-04T19:05:17Z","lastAt":"2012-09-04T19:05:17Z","messageCount":1,"participants":["Ramsay Jones"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"198334","messageId":"504650ED.1040801@ramsay1.demon.co.uk","threadId":"31437","inReplyTo":null,"subject":"[PATCH 3/3] read-cache.c: Simplify do loop conditional expression","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2012-09-04T19:05:17Z","receivedAt":"2012-09-04T19:05:17Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n\nHi Thomas,\n\nI note that index_changed(), which has no side effects, is called with\nunchanged parameters twice each time around the loop. I was about to\nsuggest saving the result of a single call and using it in both places ...\n\nHowever, on first sight, it looks like the expression in the while\ncondition will always be true (otherwise you would not reach that point\nin the code - you would already have returned), so we can simply remove\nthat part of the expression (however, I didn't look too closely, so ...)\n:-D\n\nATB,\nRamsay Jones\n\n read-cache.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/read-cache.c b/read-cache.c\nindex 36f0877..5176d7a 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -1278,7 +1278,7 @@ int read_index_from(struct index_state *istate, const char *path)\n \n \t\tusleep(10*1000);\n \t\ti++;\n-\t} while ((err || index_changed(&st_old, &st_new)) && i < 50);\n+\t} while (i < 50);\n \n \tmunmap(mmap, mmap_size);\n \tdie(\"index file corrupt\");\n-- \n1.7.12\n"}]}