$darkmode
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
io.h File Reference

Centralized secure file loading utilities. More...

#include <stddef.h>
Include dependency graph for io.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

char * io_read_file (const char *path, size_t max_size, size_t *out_size)
 Reads an entire file into a null-terminated string. More...
 

Detailed Description

Centralized secure file loading utilities.

Function Documentation

◆ io_read_file()

char* io_read_file ( const char *  path,
size_t  max_size,
size_t *  out_size 
)

Reads an entire file into a null-terminated string.

Performs security checks to prevent path traversal and applies size limits. The returned buffer must be freed by the caller.

Parameters
pathThe path to the file to read.
max_sizeMaximum allowed file size (0 for default MAX_SHADER_SOURCE_SIZE).
out_sizeOptional pointer to store the actual file size.
Returns
A null-terminated string containing file content, or NULL on error.
Here is the call graph for this function: