infix
A JIT-Powered FFI Library for C
Loading...
Searching...
No Matches
error.c File Reference

Implements the thread-local error reporting system. More...

#include "common/infix_internals.h"
#include <infix/infix.h>
#include <stdarg.h>
#include <string.h>
Include dependency graph for error.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define INFIX_TLS
 

Functions

void _infix_set_error (infix_error_category_t category, infix_error_code_t code, size_t position)
 Sets the thread-local error details for a library-internal error.
 
void _infix_set_system_error (infix_error_category_t category, infix_error_code_t code, long system_code, const char *msg)
 Sets the thread-local error details for an error originating from the OS.
 
void _infix_clear_error (void)
 Resets the thread-local error state. Called at the start of every public API function.
 
infix_error_details_t infix_get_last_error (void)
 Public API function to retrieve the last error.
 

Variables

static INFIX_TLS infix_error_details_t g_infix_last_error = {INFIX_CATEGORY_NONE, INFIX_CODE_SUCCESS, 0, 0, {0}}
 

Detailed Description

Implements the thread-local error reporting system.

Copyright (c) 2025 Sanko Robinson

This source code is dual-licensed under the Artistic License 2.0 or the MIT License. You may choose to use this code under the terms of either license.

SPDX-License-Identifier: (Artistic-2.0 OR MIT)

The documentation blocks within this file are licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).

SPDX-License-Identifier: CC-BY-4.0

Macro Definition Documentation

◆ INFIX_TLS

#define INFIX_TLS

Function Documentation

◆ _infix_clear_error()

void _infix_clear_error ( void  )

Resets the thread-local error state. Called at the start of every public API function.

◆ _infix_set_error()

void _infix_set_error ( infix_error_category_t  category,
infix_error_code_t  code,
size_t  position 
)

Sets the thread-local error details for a library-internal error.

◆ _infix_set_system_error()

void _infix_set_system_error ( infix_error_category_t  category,
infix_error_code_t  code,
long  system_code,
const char *  msg 
)

Sets the thread-local error details for an error originating from the OS.

Variable Documentation

◆ g_infix_last_error

INFIX_TLS infix_error_details_t g_infix_last_error = {INFIX_CATEGORY_NONE, INFIX_CODE_SUCCESS, 0, 0, {0}}
static