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:
@@ -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*
|
||||
|
||||
@@ -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_); \
|
||||
|
||||
Reference in New Issue
Block a user