lint: stricter casing rules

This commit is contained in:
2025-08-27 19:47:19 +02:00
parent b56aa19671
commit 6d9107b360
14 changed files with 35 additions and 31 deletions

View File

@@ -117,11 +117,11 @@ union typ_ptr {
char** string;
long long* number;
bool* boolean;
enum keys* key;
enum Keys* key;
struct Vector* vec;
uintptr_t ptr;
};
struct parser_error parse_key(enum introspection_type typ, union typ_ptr at,
struct parser_error parse_key(enum IntrospectionType typ, union typ_ptr at,
char* key, size_t offset) {
char* aux_str = NULL;
struct parser_error aux_err;

View File

@@ -68,7 +68,7 @@ free_new_envlist_extra:
return NULL;
}
char* NULLABLE xdg_ssession_type_str(enum session_type typ) {
char* NULLABLE xdg_ssession_type_str(enum SessionType typ) {
char* xdg_session_type = NULL;
if (typ == SHELL) xdg_session_type = "tty";
if (typ == XORG) xdg_session_type = "x11";
@@ -91,7 +91,7 @@ char* NULLABLE xdg_ssession_type_str(enum session_type typ) {
struct pamh_getenv_status pamh_get_complete_env(pam_handle_t* handle,
char* NNULLABLE user,
struct passwd* NNULLABLE pw,
enum session_type session_typ) {
enum SessionType session_typ) {
struct pamh_getenv_status status;
char** envlist = pam_getenvlist(handle);
if (!envlist) FAIL(status, PAMH_ERR_ERRNO, "pam_getenvlist");

View File

@@ -13,7 +13,7 @@
#include "util.h"
struct source_dir {
enum session_type type;
enum SessionType type;
char* dir;
};
@@ -72,7 +72,7 @@ struct status cb(void* _ctx, char* NULLABLE table, char* key, char* value) {
// also, always return 0 or we will break parsing and we don't want a bad
// desktop file to break all possible sessions
static enum session_type session_type;
static enum SessionType session_type;
// NOLINTNEXTLINE(readability-function-cognitive-complexity)
static int fn(const char* fpath, const struct stat* sb, int typeflag) {
// guessing symlink behavior

View File

@@ -151,7 +151,7 @@ void ui_update_cursor_focus() {
(void)printf("\x1b[%d;%dH", line, col);
}
void ui_update_field(enum input focused_input) {
void ui_update_field(enum Input focused_input) {
if (focused_input == PASSWD) {
print_passwd(utf8len(of_passwd.efield.content), false);
} else if (focused_input == SESSION) {
@@ -170,7 +170,7 @@ void ui_update_ffield() {
}
void ui_update_ofield(struct opts_field* NNULLABLE self) {
enum input input;
enum Input input;
if (self == &of_session)
input = SESSION;
else if (self == &of_user)
@@ -280,7 +280,7 @@ int load(struct Vector* users, struct Vector* sessions) {
(void)fflush(stdout);
if (!read_press_nb(&len, seq, &tv)) continue;
if (*seq == '\x1b') {
enum keys ansi_code = find_ansi(seq);
enum Keys ansi_code = find_ansi(seq);
if (ansi_code != -1) {
if (ansi_code == ESC) {
esc = 2;

View File

@@ -4,7 +4,7 @@
#include "ui.h"
#include "users.h"
enum input focused_input = PASSWD;
enum Input focused_input = PASSWD;
struct Vector* gusers;
struct Vector* gsessions;
@@ -13,7 +13,7 @@ struct opts_field of_session;
struct opts_field of_user;
struct opts_field of_passwd;
struct opts_field* NNULLABLE get_opts_field(enum input from) {
struct opts_field* NNULLABLE get_opts_field(enum Input from) {
if (from == SESSION) return &of_session;
if (from == USER) return &of_user;
if (from == PASSWD) return &of_passwd;

View File

@@ -13,10 +13,10 @@
static int selret_magic();
int find_keyname(enum keys* at, const char* name) {
int find_keyname(enum Keys* at, const char* name) {
for (size_t i = 0; i < LEN(KEY_MAPPINGS); i++) {
if (strcmp(KEY_NAMES[i], name) == 0) {
*at = (enum keys)i;
*at = (enum Keys)i;
return 0;
}
}
@@ -24,12 +24,12 @@ int find_keyname(enum keys* at, const char* name) {
return -1;
}
enum keys find_ansi(const char* seq) {
enum Keys find_ansi(const char* seq) {
for (size_t i = 0; i < LEN(KEY_MAPPINGS); i++) {
struct key_mapping mapping = KEY_MAPPINGS[i];
for (size_t j = 0; mapping.sequences[j] != NULL; j++) {
if (strcmp(mapping.sequences[j], seq) == 0) {
return (enum keys)i;
return (enum Keys)i;
}
}
}