lint(format): change format rules a bit

This commit is contained in:
javalsai 2025-06-10 23:44:40 +02:00
parent 22c3f7c896
commit bb1ca09fd8
Signed by: javalsai
SSH Key Fingerprint: SHA256:3G83yKhBUWVABVX/vPWH88xnK4+ptMtHkZGCRXD4Mk8
7 changed files with 20 additions and 27 deletions

View File

@ -2,3 +2,7 @@ BasedOnStyle: Chromium
IndentWidth: 2
SpacesBeforeTrailingComments: 1
AllowShortIfStatementsOnASingleLine: WithoutElse
AlignAfterOpenBracket: Align
BinPackParameters: true
AllowAllParametersOfDeclarationOnNextLine: true

View File

@ -6,10 +6,7 @@
#include "config.h"
#include "sessions.h"
bool launch(char* user,
char* passwd,
struct session session,
void (*cb)(void),
bool launch(char* user, char* passwd, struct session session, void (*cb)(void),
struct behavior* behavior);
#endif

View File

@ -11,7 +11,8 @@ struct status {
int ret;
};
int read_desktop(FILE* fd, void* ctx, struct status (*cb)(void* ctx, char* NULLABLE table,
char* key, char* value));
int read_desktop(FILE* fd, void* ctx,
struct status (*cb)(void* ctx, char* NULLABLE table, char* key,
char* value));
#endif

View File

@ -1,12 +1,12 @@
// Do we just replace the compiler with clang??
#if defined(__clang__)
#define NULLABLE _Nullable
#define NULLABLE _Nullable
#else
#define NULLABLE
#define NULLABLE
#endif
#if defined(__clang__)
#define NNULLABLE _Nonnull
#define NNULLABLE _Nonnull
#else
#define NNULLABLE
#define NNULLABLE
#endif

View File

@ -15,10 +15,8 @@
#include "unistd.h"
#include "util.h"
int pam_conversation(int num_msg,
const struct pam_message** msg,
struct pam_response** resp,
void* appdata_ptr) {
int pam_conversation(int num_msg, const struct pam_message** msg,
struct pam_response** resp, void* appdata_ptr) {
struct pam_response* reply =
(struct pam_response*)malloc(sizeof(struct pam_response) * num_msg);
for (size_t i = 0; i < num_msg; i++) {
@ -95,9 +93,7 @@ void sourceFileTry(char* file) {
(void)fclose(file2source);
}
void moarEnv(char* user,
struct session session,
struct passwd* pw,
void moarEnv(char* user, struct session session, struct passwd* pw,
struct behavior* behavior) {
if (chdir(pw->pw_dir) == -1) print_errno("can't chdir to user home");
@ -153,10 +149,7 @@ void moarEnv(char* user,
}
// NOLINTBEGIN(readability-function-cognitive-complexity)
bool launch(char* user,
char* passwd,
struct session session,
void (*cb)(void),
bool launch(char* user, char* passwd, struct session session, void (*cb)(void),
struct behavior* behavior) {
struct passwd* pw = getpwnam(user);
if (pw == NULL) {

View File

@ -52,8 +52,8 @@ int read_desktop(FILE* fd, void* ctx,
// Key & Value
char* key = buf;
buf[eq_idx] = '\0'; // the equal
char* value = &buf[eq_idx+1];
buf[read_size-1] = '\0'; // the newline
char* value = &buf[eq_idx + 1];
buf[read_size - 1] = '\0'; // the newline
// Callback
struct status cb_ret = cb(ctx, table_name, key, value);

View File

@ -419,8 +419,7 @@ static void clean_line(struct uint_point origin, uint line) {
}
// TODO: session_len > 32
static void print_session(struct uint_point origin,
struct session session,
static void print_session(struct uint_point origin, struct session session,
bool multiple) {
clean_line(origin, 5);
const char* session_type;
@ -454,8 +453,7 @@ static void print_session(struct uint_point origin,
}
// TODO: user_len > 32
static void print_user(struct uint_point origin,
struct user user,
static void print_user(struct uint_point origin, struct user user,
bool multiple) {
clean_line(origin, 7);
printf("\r\x1b[%luC\x1b[%sm%s\x1b[%sm",