by ams6110 · 12y ago · 0 comments
Instead of:
+ if (wb->buf == NULL)
+ if (!ssl3_setup_write_buffer(s))
+ return -1;
Why not: + if (wb->buf == NULL) {
+ if (!ssl3_setup_write_buffer(s)) {
+ return -1;
+ }
+ }Disagree you may, but it's consistent with their self-imposed guidelines.
So technically, this is still OK, but they are allowed to use braces when there are multiple lines. (the if and the return) They have an example in that link that covers this as a permitted case, but as you say, it's OK and consistent, but that doesn't make it good :)
if ((wb->buf == NULL) && !ssl3_setup_write_buffer(s)) {
return -1;
}If writing defensively by always putting braces around if statements means we no longer have to consider the possibility of a fall through error, then that saves mental processing for you and more importantly for lesser programmers.