{"thread":{"id":"55308","subject":"[PATCH] block-sha1: drop trailing semicolon from macro definition","startedAt":"2021-03-13T16:18:30Z","lastAt":"2021-03-15T23:08:18Z","messageCount":2,"participants":["René Scharfe.","Jonathan Nieder"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"419044","messageId":"f8122736-e729-5d35-e1e1-78a213816d4a@web.de","threadId":"55308","inReplyTo":null,"subject":"[PATCH] block-sha1: drop trailing semicolon from macro definition","fromName":"René Scharfe.","fromEmail":"l.s.r@web.de","sentAt":"2021-03-13T16:17:30Z","receivedAt":"2021-03-13T16:18:30Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"23119ffb4e (block-sha1: put expanded macro parameters in parentheses,\n2012-07-22) added a trailing semicolon to the definition of SHA_MIX\nwithout explanation.  It doesn't matter with the current code, but make\nsure to avoid potential surprises by removing it again.\n\nThis allows the macro to be used almost like a function: Users can\ncombine it with operators of their choice, but still must not pass an\nexpression with side-effects as a parameter, as it would be evaluated\nmultiple times.\n\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\n block-sha1/sha1.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/block-sha1/sha1.c b/block-sha1/sha1.c\nindex 8681031402..1bb6e7c069 100644\n--- a/block-sha1/sha1.c\n+++ b/block-sha1/sha1.c\n@@ -70,7 +70,7 @@\n  * the input data, the next mix it from the 512-bit array.\n  */\n #define SHA_SRC(t) get_be32((unsigned char *) block + (t)*4)\n-#define SHA_MIX(t) SHA_ROL(W((t)+13) ^ W((t)+8) ^ W((t)+2) ^ W(t), 1);\n+#define SHA_MIX(t) SHA_ROL(W((t)+13) ^ W((t)+8) ^ W((t)+2) ^ W(t), 1)\n\n #define SHA_ROUND(t, input, fn, constant, A, B, C, D, E) do { \\\n \tunsigned int TEMP = input(t); setW(t, TEMP); \\\n--\n2.30.2\n"},{"id":"419202","messageId":"YE/oq5dPDB6PvD22@google.com","threadId":"55308","inReplyTo":"f8122736-e729-5d35-e1e1-78a213816d4a@web.de","subject":"Re: [PATCH] block-sha1: drop trailing semicolon from macro definition","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2021-03-15T23:07:23Z","receivedAt":"2021-03-15T23:08:18Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"René Scharfe. wrote:\n\n> 23119ffb4e (block-sha1: put expanded macro parameters in parentheses,\n> 2012-07-22) added a trailing semicolon to the definition of SHA_MIX\n> without explanation.  It doesn't matter with the current code, but make\n> sure to avoid potential surprises by removing it again.\n>\n> This allows the macro to be used almost like a function: Users can\n> combine it with operators of their choice, but still must not pass an\n> expression with side-effects as a parameter, as it would be evaluated\n> multiple times.\n>\n> Signed-off-by: René Scharfe <l.s.r@web.de>\n> ---\n>  block-sha1/sha1.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\nYes, it was just a typo.\n"}]}