mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
don't use empty struct initializers
This commit is contained in:
parent
ddef95c297
commit
dabdffafa5
7 changed files with 27 additions and 27 deletions
10
config.c
10
config.c
|
|
@ -689,7 +689,7 @@ parse_modifiers(struct config *conf, const char *text, size_t len,
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
*modifiers = (struct config_key_modifiers){};
|
*modifiers = (struct config_key_modifiers){0};
|
||||||
char *copy = xstrndup(text, len);
|
char *copy = xstrndup(text, len);
|
||||||
|
|
||||||
for (char *tok_ctx = NULL, *key = strtok_r(copy, "+", &tok_ctx);
|
for (char *tok_ctx = NULL, *key = strtok_r(copy, "+", &tok_ctx);
|
||||||
|
|
@ -730,7 +730,7 @@ parse_key_combos(struct config *conf, const char *combos, key_combo_list_t *key_
|
||||||
combo != NULL;
|
combo != NULL;
|
||||||
combo = strtok_r(NULL, " ", &tok_ctx))
|
combo = strtok_r(NULL, " ", &tok_ctx))
|
||||||
{
|
{
|
||||||
struct config_key_modifiers modifiers = {};
|
struct config_key_modifiers modifiers = {0};
|
||||||
const char *key = strrchr(combo, '+');
|
const char *key = strrchr(combo, '+');
|
||||||
|
|
||||||
if (key == NULL) {
|
if (key == NULL) {
|
||||||
|
|
@ -1018,7 +1018,7 @@ parse_mouse_combos(struct config *conf, const char *combos, key_combo_list_t *ke
|
||||||
combo != NULL;
|
combo != NULL;
|
||||||
combo = strtok_r(NULL, " ", &tok_ctx))
|
combo = strtok_r(NULL, " ", &tok_ctx))
|
||||||
{
|
{
|
||||||
struct config_key_modifiers modifiers = {};
|
struct config_key_modifiers modifiers = {0};
|
||||||
char *key = strrchr(combo, '+');
|
char *key = strrchr(combo, '+');
|
||||||
|
|
||||||
if (key == NULL) {
|
if (key == NULL) {
|
||||||
|
|
@ -1494,7 +1494,7 @@ add_default_search_bindings(struct config *conf)
|
||||||
((struct config_key_binding_search){action, mods, sym})); \
|
((struct config_key_binding_search){action, mods, sym})); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
const struct config_key_modifiers none = {};
|
const struct config_key_modifiers none = {0};
|
||||||
const struct config_key_modifiers alt = {.alt = true};
|
const struct config_key_modifiers alt = {.alt = true};
|
||||||
const struct config_key_modifiers ctrl = {.ctrl = true};
|
const struct config_key_modifiers ctrl = {.ctrl = true};
|
||||||
const struct config_key_modifiers ctrl_shift = {.ctrl = true, .shift = true};
|
const struct config_key_modifiers ctrl_shift = {.ctrl = true, .shift = true};
|
||||||
|
|
@ -1538,7 +1538,7 @@ add_default_mouse_bindings(struct config *conf)
|
||||||
((struct config_mouse_binding){action, mods, btn, count})); \
|
((struct config_mouse_binding){action, mods, btn, count})); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
const struct config_key_modifiers none = {};
|
const struct config_key_modifiers none = {0};
|
||||||
const struct config_key_modifiers ctrl = {.ctrl = true};
|
const struct config_key_modifiers ctrl = {.ctrl = true};
|
||||||
|
|
||||||
add_binding(BIND_ACTION_PRIMARY_PASTE, none, BTN_MIDDLE, 1);
|
add_binding(BIND_ACTION_PRIMARY_PASTE, none, BTN_MIDDLE, 1);
|
||||||
|
|
|
||||||
8
input.c
8
input.c
|
|
@ -549,7 +549,7 @@ stop_repeater(struct seat *seat, uint32_t key)
|
||||||
if (key != -1 && key != seat->kbd.repeat.key)
|
if (key != -1 && key != seat->kbd.repeat.key)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (timerfd_settime(seat->kbd.repeat.fd, 0, &(struct itimerspec){}, NULL) < 0) {
|
if (timerfd_settime(seat->kbd.repeat.fd, 0, &(struct itimerspec){{0}}, NULL) < 0) {
|
||||||
LOG_ERRNO("%s: failed to disarm keyboard repeat timer", seat->name);
|
LOG_ERRNO("%s: failed to disarm keyboard repeat timer", seat->name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -843,7 +843,7 @@ keyboard_key(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
|
||||||
* Compose, and maybe emit "normal" character
|
* Compose, and maybe emit "normal" character
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uint8_t buf[64] = {};
|
uint8_t buf[64] = {0};
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
if (compose_status == XKB_COMPOSE_COMPOSED) {
|
if (compose_status == XKB_COMPOSE_COMPOSED) {
|
||||||
|
|
@ -923,7 +923,7 @@ keyboard_key(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
|
||||||
const wchar_t wc = 0x80 | buf[0];
|
const wchar_t wc = 0x80 | buf[0];
|
||||||
|
|
||||||
char utf8[8];
|
char utf8[8];
|
||||||
mbstate_t ps = {};
|
mbstate_t ps = {0};
|
||||||
size_t chars = wcrtomb(utf8, wc, &ps);
|
size_t chars = wcrtomb(utf8, wc, &ps);
|
||||||
|
|
||||||
if (chars != (size_t)-1)
|
if (chars != (size_t)-1)
|
||||||
|
|
@ -1544,7 +1544,7 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct config_key_modifiers no_mods = {};
|
const struct config_key_modifiers no_mods = {0};
|
||||||
if (memcmp(&binding->modifiers, &no_mods, sizeof(no_mods)) != 0) {
|
if (memcmp(&binding->modifiers, &no_mods, sizeof(no_mods)) != 0) {
|
||||||
/* Binding has modifiers */
|
/* Binding has modifiers */
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
6
render.c
6
render.c
|
|
@ -36,7 +36,7 @@ static struct {
|
||||||
size_t zero; /* commits presented in less than one frame interval */
|
size_t zero; /* commits presented in less than one frame interval */
|
||||||
size_t one; /* commits presented in one frame interval */
|
size_t one; /* commits presented in one frame interval */
|
||||||
size_t two; /* commits presented in two or more frame intervals */
|
size_t two; /* commits presented in two or more frame intervals */
|
||||||
} presentation_statistics = {};
|
} presentation_statistics = {0};
|
||||||
|
|
||||||
static void fdm_hook_refresh_pending_terminals(struct fdm *fdm, void *data);
|
static void fdm_hook_refresh_pending_terminals(struct fdm *fdm, void *data);
|
||||||
|
|
||||||
|
|
@ -952,11 +952,11 @@ get_csd_data(const struct terminal *term, enum csd_surface surf_idx)
|
||||||
|
|
||||||
case CSD_SURF_COUNT:
|
case CSD_SURF_COUNT:
|
||||||
assert(false);
|
assert(false);
|
||||||
return (struct csd_data){};
|
return (struct csd_data){0};
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(false);
|
assert(false);
|
||||||
return (struct csd_data){};
|
return (struct csd_data){0};
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
4
search.c
4
search.c
|
|
@ -648,7 +648,7 @@ search_input(struct seat *seat, struct terminal *term, uint32_t key,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t buf[64] = {};
|
uint8_t buf[64] = {0};
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
if (compose_status == XKB_COMPOSE_COMPOSED) {
|
if (compose_status == XKB_COMPOSE_COMPOSED) {
|
||||||
|
|
@ -666,7 +666,7 @@ search_input(struct seat *seat, struct terminal *term, uint32_t key,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const char *src = (const char *)buf;
|
const char *src = (const char *)buf;
|
||||||
mbstate_t ps = {};
|
mbstate_t ps = {0};
|
||||||
size_t wchars = mbsnrtowcs(NULL, &src, count, 0, &ps);
|
size_t wchars = mbsnrtowcs(NULL, &src, count, 0, &ps);
|
||||||
|
|
||||||
if (wchars == -1) {
|
if (wchars == -1) {
|
||||||
|
|
|
||||||
|
|
@ -325,7 +325,7 @@ selection_modify(struct terminal *term, struct coord start, struct coord end)
|
||||||
assert(start.row != -1 && start.col != -1);
|
assert(start.row != -1 && start.col != -1);
|
||||||
assert(end.row != -1 && end.col != -1);
|
assert(end.row != -1 && end.col != -1);
|
||||||
|
|
||||||
struct mark_context ctx = {};
|
struct mark_context ctx = {0};
|
||||||
|
|
||||||
/* Premark all cells that *will* be selected */
|
/* Premark all cells that *will* be selected */
|
||||||
foreach_selected(term, start, end, &premark_selected, &ctx);
|
foreach_selected(term, start, end, &premark_selected, &ctx);
|
||||||
|
|
@ -452,7 +452,7 @@ selection_dirty_cells(struct terminal *term)
|
||||||
|
|
||||||
foreach_selected(
|
foreach_selected(
|
||||||
term, term->selection.start, term->selection.end, &mark_selected,
|
term, term->selection.start, term->selection.end, &mark_selected,
|
||||||
&(struct mark_context){});
|
&(struct mark_context){0});
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -647,7 +647,7 @@ selection_cancel(struct terminal *term)
|
||||||
if (term->selection.start.row >= 0 && term->selection.end.row >= 0) {
|
if (term->selection.start.row >= 0 && term->selection.end.row >= 0) {
|
||||||
foreach_selected(
|
foreach_selected(
|
||||||
term, term->selection.start, term->selection.end,
|
term, term->selection.start, term->selection.end,
|
||||||
&unmark_selected, &(struct mark_context){});
|
&unmark_selected, &(struct mark_context){0});
|
||||||
render_refresh(term);
|
render_refresh(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
2
sixel.c
2
sixel.c
|
|
@ -231,7 +231,7 @@ sixel_overwrite(struct terminal *term, struct sixel *six,
|
||||||
row, col, height, width,
|
row, col, height, width,
|
||||||
rel_above, rel_below, rel_left, rel_right);
|
rel_above, rel_below, rel_left, rel_right);
|
||||||
|
|
||||||
struct sixel imgs[4] = {};
|
struct sixel imgs[4] = {0};
|
||||||
|
|
||||||
if (rel_above > 0) {
|
if (rel_above > 0) {
|
||||||
imgs[0] = (struct sixel){
|
imgs[0] = (struct sixel){
|
||||||
|
|
|
||||||
18
terminal.c
18
terminal.c
|
|
@ -140,7 +140,7 @@ fdm_ptmx_out(struct fdm *fdm, int fd, int events, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PTMX_TIMING
|
#if PTMX_TIMING
|
||||||
static struct timespec last = {};
|
static struct timespec last = {0};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
@ -339,7 +339,7 @@ fdm_blink(struct fdm *fdm, int fd, int events, void *data)
|
||||||
term->blink.active = false;
|
term->blink.active = false;
|
||||||
term->blink.state = BLINK_ON;
|
term->blink.state = BLINK_ON;
|
||||||
|
|
||||||
static const struct itimerspec disarm = {};
|
static const struct itimerspec disarm = {{0}};
|
||||||
if (timerfd_settime(term->blink.fd, 0, &disarm, NULL) < 0)
|
if (timerfd_settime(term->blink.fd, 0, &disarm, NULL) < 0)
|
||||||
LOG_ERRNO("failed to disarm blink timer");
|
LOG_ERRNO("failed to disarm blink timer");
|
||||||
} else
|
} else
|
||||||
|
|
@ -437,11 +437,11 @@ fdm_delayed_render(struct fdm *fdm, int fd, int events, void *data)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#if PTMX_TIMING
|
#if PTMX_TIMING
|
||||||
last = (struct timespec){};
|
last = (struct timespec){0};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Reset timers */
|
/* Reset timers */
|
||||||
struct itimerspec reset = {};
|
struct itimerspec reset = {{0}};
|
||||||
timerfd_settime(term->delayed_render_timer.lower_fd, 0, &reset, NULL);
|
timerfd_settime(term->delayed_render_timer.lower_fd, 0, &reset, NULL);
|
||||||
timerfd_settime(term->delayed_render_timer.upper_fd, 0, &reset, NULL);
|
timerfd_settime(term->delayed_render_timer.upper_fd, 0, &reset, NULL);
|
||||||
term->delayed_render_timer.is_armed = false;
|
term->delayed_render_timer.is_armed = false;
|
||||||
|
|
@ -707,7 +707,7 @@ reload_fonts(struct terminal *term)
|
||||||
{count, (const char **)names, attrs3, &fonts[3]},
|
{count, (const char **)names, attrs3, &fonts[3]},
|
||||||
};
|
};
|
||||||
|
|
||||||
thrd_t tids[4] = {};
|
thrd_t tids[4] = {0};
|
||||||
for (size_t i = 0; i < 4; i++) {
|
for (size_t i = 0; i < 4; i++) {
|
||||||
int ret = thrd_create(&tids[i], &font_loader_thread, &data[i]);
|
int ret = thrd_create(&tids[i], &font_loader_thread, &data[i]);
|
||||||
if (ret != thrd_success) {
|
if (ret != thrd_success) {
|
||||||
|
|
@ -1709,7 +1709,7 @@ cursor_blink_start_timer(struct terminal *term)
|
||||||
static bool
|
static bool
|
||||||
cursor_blink_stop_timer(struct terminal *term)
|
cursor_blink_stop_timer(struct terminal *term)
|
||||||
{
|
{
|
||||||
return timerfd_settime(term->cursor_blink.fd, 0, &(struct itimerspec){}, NULL) == 0;
|
return timerfd_settime(term->cursor_blink.fd, 0, &(struct itimerspec){{0}}, NULL) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -2279,10 +2279,10 @@ term_enable_app_sync_updates(struct terminal *term)
|
||||||
/* Disarm delayed rendering timers */
|
/* Disarm delayed rendering timers */
|
||||||
timerfd_settime(
|
timerfd_settime(
|
||||||
term->delayed_render_timer.lower_fd, 0,
|
term->delayed_render_timer.lower_fd, 0,
|
||||||
&(struct itimerspec){}, NULL);
|
&(struct itimerspec){{0}}, NULL);
|
||||||
timerfd_settime(
|
timerfd_settime(
|
||||||
term->delayed_render_timer.upper_fd, 0,
|
term->delayed_render_timer.upper_fd, 0,
|
||||||
&(struct itimerspec){}, NULL);
|
&(struct itimerspec){{0}}, NULL);
|
||||||
term->delayed_render_timer.is_armed = false;
|
term->delayed_render_timer.is_armed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2299,7 +2299,7 @@ term_disable_app_sync_updates(struct terminal *term)
|
||||||
/* Reset timers */
|
/* Reset timers */
|
||||||
timerfd_settime(
|
timerfd_settime(
|
||||||
term->render.app_sync_updates.timer_fd, 0,
|
term->render.app_sync_updates.timer_fd, 0,
|
||||||
&(struct itimerspec){}, NULL);
|
&(struct itimerspec){{0}}, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue