sway/commands: Use "!ptr" for comparison to NULL

Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
This commit is contained in:
Elyes HAOUAS 2021-04-13 10:29:50 +02:00
parent c66fb38bf8
commit dc84d9b8e8
4 changed files with 5 additions and 5 deletions

View file

@ -180,7 +180,7 @@ static void set_config_node(struct sway_node *node, bool node_overridden) {
config->handler_context.workspace = NULL;
config->handler_context.node_overridden = node_overridden;
if (node == NULL) {
if (!node) {
return;
}
@ -205,7 +205,7 @@ list_t *execute_command(char *_exec, struct sway_seat *seat,
list_t *containers = NULL;
bool using_criteria = false;
if (seat == NULL) {
if (!seat) {
// passing a NULL seat means we just pick the default seat
seat = input_manager_get_default_seat();
if (!sway_assert(seat, "could not find a seat to run the command on")) {

View file

@ -516,7 +516,7 @@ static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth,
destination = seat_get_focus_inactive(seat, &new_output->node);
} else if (strcasecmp(argv[0], "mark") == 0) {
struct sway_container *dest_con = container_find_mark(argv[1]);
if (dest_con == NULL) {
if (!dest_con) {
return cmd_results_new(CMD_FAILURE,
"Mark '%s' not found", argv[1]);
}

View file

@ -13,7 +13,7 @@ struct cmd_results *cmd_opacity(int argc, char **argv) {
struct sway_container *con = config->handler_context.container;
if (con == NULL) {
if (!con) {
return cmd_results_new(CMD_FAILURE, "No current container");
}

View file

@ -71,7 +71,7 @@ struct cmd_results *output_cmd_transform(int argc, char **argv) {
"Cannot apply relative transform to all outputs.");
}
struct sway_output *s_output = output_by_name_or_id(output->name);
if (s_output == NULL) {
if (!s_output) {
return cmd_results_new(CMD_INVALID,
"Cannot apply relative transform to unknown output %s", output->name);
}