diff options
| author | Craig Barnes <craigbarnes@protonmail.com> | 2020-08-08 19:34:30 +0000 |
|---|---|---|
| committer | Craig Barnes <craigbarnes@protonmail.com> | 2020-08-08 19:37:57 +0000 |
| commit | 7a77958ba20c2b344be5e66e69e2f212a4bbf6b3 (patch) | |
| tree | cdb8191177f5f9ca69ea7858f9543f36fcbcf616 /wayland.c | |
| parent | changelog: add birger to 'contributers' for the upcoming release (diff) | |
Convert most dynamic allocations to use functions from xmalloc.h
Diffstat (limited to 'wayland.c')
| -rw-r--r-- | wayland.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -29,6 +29,7 @@ #include "render.h" #include "selection.h" #include "util.h" +#include "xmalloc.h" static void csd_instantiate(struct wl_window *win) @@ -250,7 +251,7 @@ seat_handle_name(void *data, struct wl_seat *wl_seat, const char *name) { struct seat *seat = data; free(seat->name); - seat->name = strdup(name); + seat->name = xstrdup(name); } static const struct wl_seat_listener seat_listener = { @@ -318,8 +319,8 @@ output_geometry(void *data, struct wl_output *wl_output, int32_t x, int32_t y, mon->dim.mm.width = physical_width; mon->dim.mm.height = physical_height; mon->inch = sqrt(pow(mon->dim.mm.width, 2) + pow(mon->dim.mm.height, 2)) * 0.03937008; - mon->make = make != NULL ? strdup(make) : NULL; - mon->model = model != NULL ? strdup(model) : NULL; + mon->make = make != NULL ? xstrdup(make) : NULL; + mon->model = model != NULL ? xstrdup(model) : NULL; mon->subpixel = subpixel; output_update_ppi(mon); } @@ -389,7 +390,7 @@ xdg_output_handle_name(void *data, struct zxdg_output_v1 *xdg_output, const char *name) { struct monitor *mon = data; - mon->name = name != NULL ? strdup(name) : NULL; + mon->name = name != NULL ? xstrdup(name) : NULL; } static void @@ -397,7 +398,7 @@ xdg_output_handle_description(void *data, struct zxdg_output_v1 *xdg_output, const char *description) { struct monitor *mon = data; - mon->description = description != NULL ? strdup(description) : NULL; + mon->description = description != NULL ? xstrdup(description) : NULL; } static const struct zxdg_output_v1_listener xdg_output_listener = { @@ -973,7 +974,7 @@ fdm_wayl(struct fdm *fdm, int fd, int events, void *data) struct wayland * wayl_init(const struct config *conf, struct fdm *fdm) { - struct wayland *wayl = calloc(1, sizeof(*wayl)); + struct wayland *wayl = xcalloc(1, sizeof(*wayl)); wayl->conf = conf; wayl->fdm = fdm; wayl->fd = -1; @@ -1130,7 +1131,7 @@ wayl_win_init(struct terminal *term) struct wayland *wayl = term->wl; const struct config *conf = term->conf; - struct wl_window *win = calloc(1, sizeof(*win)); + struct wl_window *win = xcalloc(1, sizeof(*win)); win->term = term; win->use_csd = CSD_UNKNOWN; win->csd.move_timeout_fd = -1; |
