mirror of
https://github.com/javalsai/lidm.git
synced 2025-09-01 02:47:59 +02:00
format: satisfy linter
This commit is contained in:
@@ -89,7 +89,7 @@ static int fn(const char *fpath, const struct stat *sb, int typeflag) {
|
||||
|
||||
// just add this to the list
|
||||
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,
|
||||
tryexec_buf == NULL ? "" : tryexec_buf);
|
||||
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() {
|
||||
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 {
|
||||
struct user custom_user;
|
||||
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;
|
||||
return shell_session;
|
||||
} else
|
||||
return *(struct session*)vec_get(gsessions, of_session.current_opt - 1);
|
||||
return *(struct session *)vec_get(gsessions, of_session.current_opt - 1);
|
||||
} else {
|
||||
struct session custom_session;
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
// Vector shii
|
||||
struct Vector vec_new() {
|
||||
struct Vector vec;
|
||||
@@ -76,7 +75,7 @@ struct Vector vec_new() {
|
||||
return vec;
|
||||
}
|
||||
|
||||
int vec_push(struct Vector* vec, void* item) {
|
||||
int vec_push(struct Vector *vec, void *item) {
|
||||
if (vec->length >= vec->alloc_len) {
|
||||
uint32_t new_size = vec->alloc_len + 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;
|
||||
}
|
||||
|
||||
void vec_free(struct Vector* vec) {
|
||||
while(vec->length > 0)
|
||||
void vec_free(struct Vector *vec) {
|
||||
while (vec->length > 0)
|
||||
free(vec->pages[--vec->length]);
|
||||
|
||||
vec_clear(vec);
|
||||
}
|
||||
|
||||
void vec_clear(struct Vector* vec) {
|
||||
void vec_clear(struct Vector *vec) {
|
||||
free(vec->pages);
|
||||
vec_reset(vec);
|
||||
}
|
||||
|
||||
void vec_reset(struct Vector* vec) {
|
||||
void vec_reset(struct Vector *vec) {
|
||||
vec->length = 0;
|
||||
vec->alloc_len = 0;
|
||||
vec->alloc_size = 4096; // 4KiB page size?
|
||||
vec->pages = NULL;
|
||||
}
|
||||
|
||||
void* vec_pop(struct Vector* vec) {
|
||||
void *vec_pop(struct Vector *vec) {
|
||||
if (vec->length == 0)
|
||||
return NULL;
|
||||
|
||||
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)
|
||||
return NULL;
|
||||
|
||||
|
Reference in New Issue
Block a user