From 6d30e889d56d22785270c10153cb36ed11ae5cb7 Mon Sep 17 00:00:00 2001 From: javalsai Date: Sat, 21 Jun 2025 00:54:36 +0200 Subject: [PATCH] fix: language & format --- include/desktop.h | 7 ++++--- src/config.c | 8 ++++---- src/ofield.c | 5 +++-- src/util.c | 8 +++++--- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/include/desktop.h b/include/desktop.h index 3842d20..bfd829e 100644 --- a/include/desktop.h +++ b/include/desktop.h @@ -12,8 +12,9 @@ struct status { }; int read_desktop(FILE* NNULLABLE fd, void* UNULLABLE ctx, - struct status (*NNULLABLE cb)(void* UNULLABLE ctx, char* NULLABLE table, - char* NNULLABLE key, - char* NNULLABLE value)); + struct status (*NNULLABLE cb)(void* UNULLABLE ctx, + char* NULLABLE table, + char* NNULLABLE key, + char* NNULLABLE value)); #endif diff --git a/src/config.c b/src/config.c index ea1a126..31a1392 100644 --- a/src/config.c +++ b/src/config.c @@ -127,10 +127,10 @@ struct parser_error parse_key(enum introspection_type typ, union typ_ptr at, if (!aux_str) FAIL("allocation failure"); aux_err = parse_str_inplace(aux_str); if (aux_err.msg != NULL) return aux_err; - // FIXME: it be broken, prob the ptr arithmetic or smth, we mem leak instead 😎 - // If the ptr is not the default it means it was prev allocated, we should - // free - // if (*(char**)((uintptr_t)(&default_config) + offset) != *at.string) { + // FIXME: it be broken, prob the ptr arithmetic or smth, we mem leak + // instead 😎 If the ptr is not the default it means it was prev + // allocated, we should free if (*(char**)((uintptr_t)(&default_config) + + // offset) != *at.string) { // free(*at.string); // } *at.string = aux_str; diff --git a/src/ofield.c b/src/ofield.c index ff93d06..0914412 100644 --- a/src/ofield.c +++ b/src/ofield.c @@ -33,11 +33,12 @@ void ofield_kbd_type(struct opts_field* self, char* typed, } bool ofield_opts_seek(struct opts_field* self, char seek) { - // no options or (a single option but its selected isntead of on edit) + // no options or (a single option but its selected instead of on edit) if (self->opts == 0 || (self->opts == 1 && self->current_opt != 0)) return false; - self->current_opt = 1 + ((self->current_opt - 1 + seek + self->opts) % self->opts); + self->current_opt = + 1 + ((self->current_opt - 1 + seek + self->opts) % self->opts); ui_update_ofield(self); return true; } diff --git a/src/util.c b/src/util.c index a653a41..bcc8ec6 100644 --- a/src/util.c +++ b/src/util.c @@ -90,16 +90,18 @@ size_t utf8len_until(const char* str, const char* until) { } const char* utf8back(const char* str) { - while(utf8_iscont(*(--str))) {} + while (utf8_iscont(*(--str))) { + } return str; } const char* utf8seek(const char* str) { - while(utf8_iscont(*(++str))) {} + while (utf8_iscont(*(++str))) { + } return str; } const char* utf8seekn(const char* str, size_t n) { - while(n > 0 && *str != '\0') { + while (n > 0 && *str != '\0') { str = utf8seek(str); n--; }