Move check for NULL boss into call_boss()

Negligible perf impact and makes it safe to use in different contexts
This commit is contained in:
Kovid Goyal
2018-03-27 09:56:29 +05:30
parent eddee67130
commit 1e6a41186f
2 changed files with 2 additions and 2 deletions

View File

@@ -1772,7 +1772,7 @@ screen_update_selection(Screen *self, index_type x, index_type y, bool ended) {
break;
}
if (found) self->selection.end_x = end;
if (global_state.boss) call_boss(set_primary_selection, NULL);
call_boss(set_primary_selection, NULL);
}
static PyObject*

View File

@@ -137,7 +137,7 @@ typedef struct {
extern GlobalState global_state;
#define call_boss(name, ...) { \
#define call_boss(name, ...) if (global_state.boss) { \
PyObject *cret_ = PyObject_CallMethod(global_state.boss, #name, __VA_ARGS__); \
if (cret_ == NULL) { PyErr_Print(); } \
else Py_DECREF(cret_); \