Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
Loading...
Searching...
No Matches
app_subsystem.c File Reference
#include "app_subsystem.h"
#include "app.h"
#include "log.h"
Include dependency graph for app_subsystem.c:

Functions

int app_subsystems_init (struct App *app, const SubsystemDescriptor *table)
 Walk table forward calling init() until the sentinel {0}.
 
void app_subsystems_cleanup (struct App *app, const SubsystemDescriptor *table)
 Walk table in reverse, calling cleanup() for each entry.
 

Variables

static const char *const LOG_TAG = "suckless-ogl.subsystem"
 

Function Documentation

◆ app_subsystems_cleanup()

void app_subsystems_cleanup ( struct App *  app,
const SubsystemDescriptor *  table 
)

Walk table in reverse, calling cleanup() for each entry.

Skips entries whose cleanup function pointer is NULL. The table must be terminated by a {0} sentinel entry. Intended for the normal shutdown path after a successful init.

◆ app_subsystems_init()

int app_subsystems_init ( struct App *  app,
const SubsystemDescriptor *  table 
)

Walk table forward calling init() until the sentinel {0}.

On the first failure at index N, cleanup() is called in reverse for entries [N-1 .. 0], then 0 is returned. The table must be terminated by a {0} sentinel entry.

Returns
1 if all init() calls succeed, 0 on first failure.

Variable Documentation

◆ LOG_TAG

const char* const LOG_TAG = "suckless-ogl.subsystem"
static