mirror of
https://github.com/javalsai/lidm.git
synced 2025-08-30 18:08:00 +02:00
feat|perf: generic&efficient desktop&config parser
This commit is contained in:
17
include/desktop.h
Normal file
17
include/desktop.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef DESKTOPH_
|
||||
#define DESKTOPH_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "macros.h"
|
||||
|
||||
struct status {
|
||||
bool finish;
|
||||
int ret;
|
||||
};
|
||||
|
||||
int read_desktop(FILE* fd, void* ctx, struct status (*cb)(void* ctx, char* NULLABLE table,
|
||||
char* key, char* value));
|
||||
|
||||
#endif
|
12
include/macros.h
Normal file
12
include/macros.h
Normal file
@@ -0,0 +1,12 @@
|
||||
// Do we just replace the compiler with clang??
|
||||
#if defined(__clang__)
|
||||
#define NULLABLE _Nullable
|
||||
#else
|
||||
#define NULLABLE
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
#define NNULLABLE _Nonnull
|
||||
#else
|
||||
#define NNULLABLE
|
||||
#endif
|
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "macros.h"
|
||||
#include "util.h"
|
||||
|
||||
enum session_type {
|
||||
@@ -12,9 +13,9 @@ enum session_type {
|
||||
};
|
||||
|
||||
struct session {
|
||||
char* name;
|
||||
char* exec;
|
||||
char* tryexec;
|
||||
char* NNULLABLE name;
|
||||
char* NNULLABLE exec;
|
||||
char* NULLABLE tryexec;
|
||||
enum session_type type;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user