mirror of
https://github.com/javalsai/lidm.git
synced 2025-07-03 22:38:41 +02:00
format: satisfy linter
This commit is contained in:
parent
44d7836955
commit
0b02a2cef2
@ -6,6 +6,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "sessions.h"
|
#include "sessions.h"
|
||||||
|
|
||||||
bool launch(char *user, char *passwd, struct session session, void (*cb)(void), struct behavior* behavior);
|
bool launch(char *user, char *passwd, struct session session, void (*cb)(void),
|
||||||
|
struct behavior *behavior);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
void setup(struct config);
|
void setup(struct config);
|
||||||
int load(struct Vector * users, struct Vector * sessions);
|
int load(struct Vector *users, struct Vector *sessions);
|
||||||
void print_err(const char *);
|
void print_err(const char *);
|
||||||
void print_errno(const char *);
|
void print_errno(const char *);
|
||||||
|
|
||||||
|
@ -17,15 +17,15 @@ struct Vector {
|
|||||||
uint32_t length;
|
uint32_t length;
|
||||||
uint32_t alloc_len;
|
uint32_t alloc_len;
|
||||||
uint16_t alloc_size;
|
uint16_t alloc_size;
|
||||||
void** pages;
|
void **pages;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Vector vec_new();
|
struct Vector vec_new();
|
||||||
int vec_push(struct Vector*, void* item);
|
int vec_push(struct Vector *, void *item);
|
||||||
void vec_free(struct Vector*);
|
void vec_free(struct Vector *);
|
||||||
void vec_clear(struct Vector*);
|
void vec_clear(struct Vector *);
|
||||||
void vec_reset(struct Vector*);
|
void vec_reset(struct Vector *);
|
||||||
void* vec_pop(struct Vector*); // won't free it, nor shrink vec list space
|
void *vec_pop(struct Vector *); // won't free it, nor shrink vec list space
|
||||||
void* vec_get(struct Vector*, size_t index);
|
void *vec_get(struct Vector *, size_t index);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -89,7 +89,7 @@ static int fn(const char *fpath, const struct stat *sb, int typeflag) {
|
|||||||
|
|
||||||
// just add this to the list
|
// just add this to the list
|
||||||
if (name_buf != NULL && exec_buf != NULL) {
|
if (name_buf != NULL && exec_buf != NULL) {
|
||||||
struct session *session_i = malloc(sizeof (struct session));
|
struct session *session_i = malloc(sizeof(struct session));
|
||||||
*session_i = __new_session(session_type, name_buf, exec_buf,
|
*session_i = __new_session(session_type, name_buf, exec_buf,
|
||||||
tryexec_buf == NULL ? "" : tryexec_buf);
|
tryexec_buf == NULL ? "" : tryexec_buf);
|
||||||
vec_push(cb_sessions, session_i);
|
vec_push(cb_sessions, session_i);
|
||||||
|
4
src/ui.c
4
src/ui.c
@ -219,7 +219,7 @@ void ffield_cursor_focus() {
|
|||||||
|
|
||||||
struct user get_current_user() {
|
struct user get_current_user() {
|
||||||
if (of_user.current_opt != 0)
|
if (of_user.current_opt != 0)
|
||||||
return *(struct user*)vec_get(gusers, of_user.current_opt - 1);
|
return *(struct user *)vec_get(gusers, of_user.current_opt - 1);
|
||||||
else {
|
else {
|
||||||
struct user custom_user;
|
struct user custom_user;
|
||||||
custom_user.shell = "/usr/bin/bash";
|
custom_user.shell = "/usr/bin/bash";
|
||||||
@ -239,7 +239,7 @@ struct session get_current_session() {
|
|||||||
shell_session.exec = shell_session.name = get_current_user().shell;
|
shell_session.exec = shell_session.name = get_current_user().shell;
|
||||||
return shell_session;
|
return shell_session;
|
||||||
} else
|
} else
|
||||||
return *(struct session*)vec_get(gsessions, of_session.current_opt - 1);
|
return *(struct session *)vec_get(gsessions, of_session.current_opt - 1);
|
||||||
} else {
|
} else {
|
||||||
struct session custom_session;
|
struct session custom_session;
|
||||||
custom_session.type = SHELL;
|
custom_session.type = SHELL;
|
||||||
|
15
src/util.c
15
src/util.c
@ -68,7 +68,6 @@ static int selret_magic() {
|
|||||||
return select(1, &set, NULL, NULL, &timeout);
|
return select(1, &set, NULL, NULL, &timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Vector shii
|
// Vector shii
|
||||||
struct Vector vec_new() {
|
struct Vector vec_new() {
|
||||||
struct Vector vec;
|
struct Vector vec;
|
||||||
@ -76,7 +75,7 @@ struct Vector vec_new() {
|
|||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vec_push(struct Vector* vec, void* item) {
|
int vec_push(struct Vector *vec, void *item) {
|
||||||
if (vec->length >= vec->alloc_len) {
|
if (vec->length >= vec->alloc_len) {
|
||||||
uint32_t new_size = vec->alloc_len + vec->alloc_size;
|
uint32_t new_size = vec->alloc_len + vec->alloc_size;
|
||||||
void **new_location = realloc(vec->pages, vec->alloc_size);
|
void **new_location = realloc(vec->pages, vec->alloc_size);
|
||||||
@ -93,33 +92,33 @@ int vec_push(struct Vector* vec, void* item) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vec_free(struct Vector* vec) {
|
void vec_free(struct Vector *vec) {
|
||||||
while(vec->length > 0)
|
while (vec->length > 0)
|
||||||
free(vec->pages[--vec->length]);
|
free(vec->pages[--vec->length]);
|
||||||
|
|
||||||
vec_clear(vec);
|
vec_clear(vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vec_clear(struct Vector* vec) {
|
void vec_clear(struct Vector *vec) {
|
||||||
free(vec->pages);
|
free(vec->pages);
|
||||||
vec_reset(vec);
|
vec_reset(vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vec_reset(struct Vector* vec) {
|
void vec_reset(struct Vector *vec) {
|
||||||
vec->length = 0;
|
vec->length = 0;
|
||||||
vec->alloc_len = 0;
|
vec->alloc_len = 0;
|
||||||
vec->alloc_size = 4096; // 4KiB page size?
|
vec->alloc_size = 4096; // 4KiB page size?
|
||||||
vec->pages = NULL;
|
vec->pages = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* vec_pop(struct Vector* vec) {
|
void *vec_pop(struct Vector *vec) {
|
||||||
if (vec->length == 0)
|
if (vec->length == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return vec->pages[--vec->length];
|
return vec->pages[--vec->length];
|
||||||
}
|
}
|
||||||
|
|
||||||
void* vec_get(struct Vector* vec, size_t index) {
|
void *vec_get(struct Vector *vec, size_t index) {
|
||||||
if (index >= vec->length)
|
if (index >= vec->length)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user