Skip to content
Myr

xmalloc/xsnprintf: use x-wrapper functions in a few more places

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Craig Barnes · committed by Craig Barnes · parent ab9a3dc · Browse files · 4 files+8 added−14 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+8 added−14 removed

  • other:+8 added−14 removed

4 files+8 added−14 removed

modified:config.c+3 added-10 removed
727 unmodified lines
728 LOG_CONTEXTUAL_ERRNO("failed to expand '~'");729 return false;730 }731732 if (asprintf(&_include_path, "%s/%s", home_dir, value + 2) < 0) {733 LOG_ERRNO("failed to allocate path for include directive");734 return false;735 }732 _include_path = xstrjoin3(home_dir, "/", value + 2);733 include_path = _include_path;734 } else735 include_path = value;736
828 unmodified lines
1565 {BIND_ACTION_CUSTOM_19, m_alt, {{XKB_KEY_parenleft}}},1566 };15671568 conf->key_bindings.count = ALEN(bindings);1572 conf->key_bindings.arr = xmalloc(sizeof(bindings));1573 memcpy(conf->key_bindings.arr, bindings, sizeof(bindings));1569 conf->key_bindings.arr = xmemdup(bindings, sizeof(bindings));1570}15711572bool1573config_load(struct config *conf, const char *conf_path,
81 unmodified lines
1655 struct config_file conf_file = {.path = NULL, .fd = -1};16561657 const char *terminal = getenv("TERMINAL");1658 if (terminal != NULL) {1663 if (asprintf(&conf->terminal, "%s -e", terminal) < 0) {1664 LOG_ERRNO("failed to build default terminal command line");1665 goto out;1666 }1659 conf->terminal = xstrjoin(terminal, " -e");1660 }16611662 if (conf_path != NULL) {1663 int fd = open(conf_path, O_RDONLY);
67 unmodified lines
modified:main.c+2 added-2 removed
264 unmodified lines
265 }266 }267268 char count_as_str[11];269 sprintf(count_as_str, "%u", apps->v[i]->count);270 const size_t count_len = strlen(count_as_str);269 const size_t count_len = xsnprintf(270 count_as_str, sizeof(count_as_str), "%u", apps->v[i]->count);271272 if (write(fd, "|", 1) != 1 ||273 write(fd, count_as_str, count_len) != count_len ||274 write(fd, "\n", 1) != 1)
1710 unmodified lines
modified:match.c+2 added-1 removed
27 unmodified lines
28#include "log.h"29#include "char32.h"30#include "wayland.h"31#include "xmalloc.h"32#include "xsnprintf.h"3334#define min(x, y) ((x < y) ? (x) : (y))35#define max(x, y) ((x > y) ? (x) : (y))36
1254 unmodified lines
1291 sigfillset(&mask);1292 pthread_sigmask(SIG_SETMASK, &mask, NULL);12931294 char proc_title[16];1294 snprintf(proc_title, sizeof(proc_title), "fuzzel:match:%d", my_id);1295 xsnprintf(proc_title, sizeof(proc_title), "fuzzel:match:%d", my_id);12961297 if (pthread_setname_np(pthread_self(), proc_title) < 0)1298 LOG_ERRNO("render worker %d: failed to set process title", my_id);1299
349 unmodified lines
modified:render.c+1 added-1 removed
1157 unmodified lines
1158 sigfillset(&mask);1159 pthread_sigmask(SIG_SETMASK, &mask, NULL);11601161 char proc_title[16];1162 snprintf(proc_title, sizeof(proc_title), "fuzzel:rend:%d", my_id);1162 xsnprintf(proc_title, sizeof(proc_title), "fuzzel:rend:%d", my_id);11631164 if (pthread_setname_np(pthread_self(), proc_title) < 0)1165 LOG_ERRNO("render worker %d: failed to set process title", my_id);1166
287 unmodified lines