Blender Git Loki

Git Commits -> Revision 90a27d5

Revision 90a27d5 by Sybren A. Stüvel (master)
October 2, 2020, 16:56 (GMT)
Cleanup: Use enum for return values in context callbacks

Define enum `eContextResult` and use its values for returns, instead of
just returning 1, 0, or -1 (and always having some comment that explains
what -1 means).

This also cleans up the mixup between returning `0` and `false`, and `1`
and `true`. An inconsistency was discovered during this cleanup, and
marked with `TODO(sybren)`. It's not fixed here, as it would consititute
a functional change.

The enum isn't used everywhere, as enums in C and C++ can have different
storage sizes. To prevent issues, callback functions are still declared
as returning`int`. To at least make things easier to understand for
humans, I marked those with `int /*eContextResult*/`.

This is a followup of D9090, and is intended to unify how context
callbacks return values. This will make it easier to extend the approach
in D9090 to those functions.

No functional changes.

Differential Revision: https://developer.blender.org/D9095

Commit Details:

Full Hash: 90a27d5aa91a1b6a25ea14e11c889d47f77f4cf7
Parent Commit: 0db98b2
Lines Changed: +267, -229

12 Modified Paths:

/source/blender/blenkernel/BKE_context.h (+21, -4) (Diff)
/source/blender/blenkernel/BKE_screen.h (+4, -2) (Diff)
/source/blender/blenkernel/intern/context.c (+9, -10) (Diff)
/source/blender/editors/screen/screen_context.c (+140, -132) (Diff)
/source/blender/editors/space_buttons/buttons_context.c (+50, -48) (Diff)
/source/blender/editors/space_clip/space_clip.c (+7, -5) (Diff)
/source/blender/editors/space_image/space_image.c (+7, -4) (Diff)
/source/blender/editors/space_node/space_node.c (+11, -10) (Diff)
/source/blender/editors/space_sequencer/space_sequencer.c (+6, -4) (Diff)
/source/blender/editors/space_text/space_text.c (+6, -4) (Diff)
/source/blender/makesdna/DNA_screen_types.h (+1, -1) (Diff)
/source/blender/python/intern/bpy_rna.c (+5, -5) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021