mirror of
https://github.com/javalsai/lidm.git
synced 2025-07-05 07:18:43 +02:00
lint(format): change format rules a bit
This commit is contained in:
parent
22c3f7c896
commit
bb1ca09fd8
@ -2,3 +2,7 @@ BasedOnStyle: Chromium
|
|||||||
IndentWidth: 2
|
IndentWidth: 2
|
||||||
SpacesBeforeTrailingComments: 1
|
SpacesBeforeTrailingComments: 1
|
||||||
AllowShortIfStatementsOnASingleLine: WithoutElse
|
AllowShortIfStatementsOnASingleLine: WithoutElse
|
||||||
|
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
BinPackParameters: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
@ -6,10 +6,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "sessions.h"
|
#include "sessions.h"
|
||||||
|
|
||||||
bool launch(char* user,
|
bool launch(char* user, char* passwd, struct session session, void (*cb)(void),
|
||||||
char* passwd,
|
|
||||||
struct session session,
|
|
||||||
void (*cb)(void),
|
|
||||||
struct behavior* behavior);
|
struct behavior* behavior);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,7 +11,8 @@ struct status {
|
|||||||
int ret;
|
int ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
int read_desktop(FILE* fd, void* ctx, struct status (*cb)(void* ctx, char* NULLABLE table,
|
int read_desktop(FILE* fd, void* ctx,
|
||||||
char* key, char* value));
|
struct status (*cb)(void* ctx, char* NULLABLE table, char* key,
|
||||||
|
char* value));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
// Do we just replace the compiler with clang??
|
// Do we just replace the compiler with clang??
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
#define NULLABLE _Nullable
|
#define NULLABLE _Nullable
|
||||||
#else
|
#else
|
||||||
#define NULLABLE
|
#define NULLABLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
#define NNULLABLE _Nonnull
|
#define NNULLABLE _Nonnull
|
||||||
#else
|
#else
|
||||||
#define NNULLABLE
|
#define NNULLABLE
|
||||||
#endif
|
#endif
|
||||||
|
15
src/auth.c
15
src/auth.c
@ -15,10 +15,8 @@
|
|||||||
#include "unistd.h"
|
#include "unistd.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
int pam_conversation(int num_msg,
|
int pam_conversation(int num_msg, const struct pam_message** msg,
|
||||||
const struct pam_message** msg,
|
struct pam_response** resp, void* appdata_ptr) {
|
||||||
struct pam_response** resp,
|
|
||||||
void* appdata_ptr) {
|
|
||||||
struct pam_response* reply =
|
struct pam_response* reply =
|
||||||
(struct pam_response*)malloc(sizeof(struct pam_response) * num_msg);
|
(struct pam_response*)malloc(sizeof(struct pam_response) * num_msg);
|
||||||
for (size_t i = 0; i < num_msg; i++) {
|
for (size_t i = 0; i < num_msg; i++) {
|
||||||
@ -95,9 +93,7 @@ void sourceFileTry(char* file) {
|
|||||||
(void)fclose(file2source);
|
(void)fclose(file2source);
|
||||||
}
|
}
|
||||||
|
|
||||||
void moarEnv(char* user,
|
void moarEnv(char* user, struct session session, struct passwd* pw,
|
||||||
struct session session,
|
|
||||||
struct passwd* pw,
|
|
||||||
struct behavior* behavior) {
|
struct behavior* behavior) {
|
||||||
if (chdir(pw->pw_dir) == -1) print_errno("can't chdir to user home");
|
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)
|
// NOLINTBEGIN(readability-function-cognitive-complexity)
|
||||||
bool launch(char* user,
|
bool launch(char* user, char* passwd, struct session session, void (*cb)(void),
|
||||||
char* passwd,
|
|
||||||
struct session session,
|
|
||||||
void (*cb)(void),
|
|
||||||
struct behavior* behavior) {
|
struct behavior* behavior) {
|
||||||
struct passwd* pw = getpwnam(user);
|
struct passwd* pw = getpwnam(user);
|
||||||
if (pw == NULL) {
|
if (pw == NULL) {
|
||||||
|
@ -52,8 +52,8 @@ int read_desktop(FILE* fd, void* ctx,
|
|||||||
// Key & Value
|
// Key & Value
|
||||||
char* key = buf;
|
char* key = buf;
|
||||||
buf[eq_idx] = '\0'; // the equal
|
buf[eq_idx] = '\0'; // the equal
|
||||||
char* value = &buf[eq_idx+1];
|
char* value = &buf[eq_idx + 1];
|
||||||
buf[read_size-1] = '\0'; // the newline
|
buf[read_size - 1] = '\0'; // the newline
|
||||||
|
|
||||||
// Callback
|
// Callback
|
||||||
struct status cb_ret = cb(ctx, table_name, key, value);
|
struct status cb_ret = cb(ctx, table_name, key, value);
|
||||||
|
6
src/ui.c
6
src/ui.c
@ -419,8 +419,7 @@ static void clean_line(struct uint_point origin, uint line) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: session_len > 32
|
// TODO: session_len > 32
|
||||||
static void print_session(struct uint_point origin,
|
static void print_session(struct uint_point origin, struct session session,
|
||||||
struct session session,
|
|
||||||
bool multiple) {
|
bool multiple) {
|
||||||
clean_line(origin, 5);
|
clean_line(origin, 5);
|
||||||
const char* session_type;
|
const char* session_type;
|
||||||
@ -454,8 +453,7 @@ static void print_session(struct uint_point origin,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: user_len > 32
|
// TODO: user_len > 32
|
||||||
static void print_user(struct uint_point origin,
|
static void print_user(struct uint_point origin, struct user user,
|
||||||
struct user user,
|
|
||||||
bool multiple) {
|
bool multiple) {
|
||||||
clean_line(origin, 7);
|
clean_line(origin, 7);
|
||||||
printf("\r\x1b[%luC\x1b[%sm%s\x1b[%sm",
|
printf("\r\x1b[%luC\x1b[%sm%s\x1b[%sm",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user