mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-21 16:05:02 +02:00
Simplify code a bit
This commit is contained in:
3
glfw/xkb_glfw.c
vendored
3
glfw/xkb_glfw.c
vendored
@@ -508,7 +508,8 @@ format_xkb_mods(_GLFWXKBData *xkb, const char* name, xkb_mod_mask_t mods) {
|
||||
char *p = buf, *s;
|
||||
#define pr(x) { \
|
||||
int num_needed = -1; \
|
||||
if (sizeof(buf) > (unsigned long)((p - buf) + 1)) num_needed = snprintf(p, sizeof(buf) - (p - buf) - 1, "%s", x); \
|
||||
ssize_t space_left = sizeof(buf) - (p - buf) - 1; \
|
||||
if (space_left > 0) num_needed = snprintf(p, space_left, "%s", x); \
|
||||
if (num_needed > 0) p += num_needed; \
|
||||
}
|
||||
pr(name); pr(": ");
|
||||
|
||||
Reference in New Issue
Block a user