diff -w when removing nested braces (thus unindenting)
Hi,
When removing nested braces, it would be nice if the diff algorithm could try to remove the brace in a way that it fits semantically. Considering the following diff:
Quoted 27 lines
src/nxt_http_parse.c +5
-3@@ -351,29 +351,30 @@ nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos, }while (*p ==' ' ); -if (memcmp (p,"HTTP/" ,nxt_min (end - p,5 )) ==0 ) { +if (memcmp (p,"HTTP/" ,nxt_min (end - p,5 )) !=0 ) { +return NXT_HTTP_PARSE_INVALID ; + }switch (end - p) {case 8 :if (p[7 ] <'0' || p[7 ] >'9' ) { -break ; +return NXT_HTTP_PARSE_INVALID ; }/* Fall through. */ case 7 :if (p[6 ] !='.' ) { -break ; +return NXT_HTTP_PARSE_INVALID ; }/* Fall through. */ case 6 :
src/nxt_http_parse.c nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos, · line 376
Quoted 10 lines
src/nxt_http_parse.c +1
-2if (p[5 ] <'0' || p[5 ] >'9' ) { -break ; +return NXT_HTTP_PARSE_INVALID ; }/* Fall through. */ default :return NXT_AGAIN ; } } - }
This brace removal looks like it would be an unmatching brace. It would be nicer if the diff showed this:
}
- }
}Although I'm conscious that this might be a wild wish impossible to implement; so I'd just like you to know this little itch of mine in case you consider it doable.
Cheers,
Alex
Quoted 3 lines
src/nxt_http_parse.c +0
-0/* " HTTP/1.1\r\n" or " HTTP/1.1\n" */
Signature · 2 lines
<http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5