Blender Git Loki

Git Commits -> Revision 4283da8

Revision 4283da8 by Sybren A. Stüvel (master)
July 3, 2020, 14:15 (GMT)
Cleanup: Explicit return in each `else if` block in `ed_screen_context()`

The `ed_screen_context()` function is approximately 700 lines long, and
its main structure is a huge chain of `else if` statements. Some of the
bodies did not return, but rather fell through and relied on the `return
-1;` at the bottom of the function. This means that in order to truly
understand what is going on in one of those `else if` blocks, it could
be required to scroll past all the following `else if` blocks,
double-checking that they all had an `else`, and then see what happens
below.

By adding explicit `return -1;` everywhere this happened, this is all
avoided, increasing local understandability of the code. Furthermore, it
makes the upcoming cleanup with the Clang-Tidy rule
`readability-else-after-return` a lot easier to do.

No functional changes.

Commit Details:

Full Hash: 4283da83cc9e307e6e5ce03916bb08a2adb02eba
Parent Commit: de7c9f4
Lines Changed: +25, -0

1 Modified Path:

/source/blender/editors/screen/screen_context.c (+25, -0) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021