Commit 96e20bbc3c799275a645bf3b3f6bae3501f8f0b8 Parent: 850120639ceb282769bad0e24577c867ff4ca6d8 Author: mcol <mcol@posteo.net> Date: 2021-01-24 22:13:08 +0000 Committer: mcol <mcol@posteo.net> Committed: 2021-01-24 22:13:08 +0000 remove THIS definition
src/types.h Modified
@@ -15,7 +15,6 @@ #include <wlr/types/wlr_xdg_shell.h> #include <wlr/util/log.h> -#define THIS "wimp" enum cursor_mode { CURSOR_PASSTHROUGH,
src/main.c Modified
@@ -36,7 +36,7 @@ static const char usage[] = - "usage: " THIS " [options...]\n" + "usage: wimp [options...]\n" " -h show this help message\n" " -c <file> specify config file\n" " -d set logging to debug mode\n"
src/config.c Modified
@@ -12,8 +12,8 @@ #include "types.h" #define is_number(s) (strspn(s, "0123456789.-") == strlen(s)) -#define CONFIG_HOME "$HOME/.config/" THIS ".conf" -#define CONFIG_HOME_XDG "$XDG_CONFIG_HOME/.config/" THIS ".conf" +#define CONFIG_HOME "$HOME/.config/wimp.conf" +#define CONFIG_HOME_XDG "$XDG_CONFIG_HOME/.config/wimp.conf" static const char *DEFAULT_CONFIG = "\n\ @@ -90,19 +90,18 @@ static void motion_handler(struct binding *kb, char *data) { - kb->data = calloc(1, sizeof(struct motion)); char *s; if (!data) - goto fail; + return; s = strtok(data, " \t\n\r"); if (!is_number(s) || !data) - goto fail; + return; int x = atoi(s); s = strtok(NULL, " \t\n\r"); if (!is_number(s)) - goto fail; + return; int y = atoi(s); struct motion motion = { @@ -110,11 +109,8 @@ .dy = y, .is_percentage = true, }; + kb->data = calloc(1, sizeof(struct motion)); *(struct motion *)(kb->data) = motion; - return; - -fail: - free(kb->data); }