fix: satify clang nullability requirements

This commit is contained in:
2025-08-27 22:07:04 +02:00
parent 109c9bd0be
commit ff3e58ee5b
2 changed files with 11 additions and 11 deletions

View File

@@ -19,27 +19,27 @@ enum ExecType {
}; };
struct desktop_exec { struct desktop_exec {
char** args; char* NULLABLE* NNULLABLE args;
int arg_count; int arg_count;
}; };
struct session_exec { struct session_exec {
enum ExecType typ; enum ExecType typ;
union { union {
char* shell; char* NNULLABLE shell;
struct desktop_exec desktop; struct desktop_exec desktop;
}; };
}; };
static inline struct session_exec session_exec_shell(char* shell) { static inline struct session_exec session_exec_shell(char* NNULLABLE shell) {
return (struct session_exec){ return (struct session_exec){
.typ = EXEC_SHELL, .typ = EXEC_SHELL,
.shell = shell, .shell = shell,
}; };
} }
static inline struct session_exec session_exec_desktop(int arg_count, static inline struct session_exec session_exec_desktop(
char** args) { int arg_count, char* NULLABLE* NNULLABLE args) {
return (struct session_exec){ return (struct session_exec){
.typ = EXEC_DESKTOP, .typ = EXEC_DESKTOP,
.desktop = .desktop =
@@ -50,8 +50,8 @@ static inline struct session_exec session_exec_desktop(int arg_count,
}; };
} }
static inline int session_exec_exec(struct session_exec* exec, static inline int session_exec_exec(struct session_exec* NNULLABLE exec,
char** NNULLABLE envlist) { char* NULLABLE* NNULLABLE envlist) {
switch (exec->typ) { switch (exec->typ) {
case EXEC_SHELL: case EXEC_SHELL:
return execle(exec->shell, exec->shell, NULL, envlist); return execle(exec->shell, exec->shell, NULL, envlist);

View File

@@ -19,7 +19,7 @@
#include "util.h" #include "util.h"
static void try_source_file(struct Vector* NNULLABLE vec_envlist, static void try_source_file(struct Vector* NNULLABLE vec_envlist,
char* NNULLABLE filepath) { char* NNULLABLE filepath) {
log_printf("sourcing %s\n", filepath); log_printf("sourcing %s\n", filepath);
FILE* file2source = fopen(filepath, "r"); FILE* file2source = fopen(filepath, "r");
if (file2source == NULL) { if (file2source == NULL) {
@@ -49,9 +49,9 @@ static void try_source_file(struct Vector* NNULLABLE vec_envlist,
} }
static void source_paths(struct Vector* NNULLABLE vec_envlist, static void source_paths(struct Vector* NNULLABLE vec_envlist,
struct Vector* NNULLABLE abs_source, struct Vector* NNULLABLE abs_source,
const char* NULLABLE user_home, const char* NULLABLE user_home,
struct Vector* NNULLABLE user_source) { struct Vector* NNULLABLE user_source) {
for (size_t i = 0; i < abs_source->length; i++) { for (size_t i = 0; i < abs_source->length; i++) {
char* path = vec_get(abs_source, i); char* path = vec_get(abs_source, i);
try_source_file(vec_envlist, path); try_source_file(vec_envlist, path);