LexLeo 0.0.0-dev+f8e5087-dirty
Technical documentation
Loading...
Searching...
No Matches
lexleo_panic.c
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-3.0-or-later
2 * Copyright (C) 2026 Sylvain Labopin
3 */
4
7
9
10#include "osal/mem/osal_mem.h"
11
12void lexleo_panic(const char *msg) {
13 const osal_stdio_ops_t *stdio_ops = osal_stdio_default_ops();
14 OSAL_STDIO *err = stdio_ops->stderr();
15 const char *text = msg ? msg : "(no message)";
16 (void)stdio_ops->write("LexLeo panic: ", 1, 15, err);
17 (void)stdio_ops->write(text, 1, osal_strlen(text), err);
18 (void)stdio_ops->write("\n", 1, 1, err);
19 (void)stdio_ops->flush(err);
20 abort();
21}
22
23void lexleo_panic_oom(void) {
24 lexleo_panic("out of memory");
25}
void lexleo_panic_oom(void)
void lexleo_panic(const char *msg)
size_t osal_strlen(const char *s)
Definition osal_mem.c:35
const osal_stdio_ops_t * osal_stdio_default_ops(void)
Definition osal_stdio.c:79
size_t(* write)(const void *ptr, size_t size, size_t nmemb, OSAL_STDIO *stdio)
OSAL_STDIO *(* stderr)(void)
int(* flush)(OSAL_STDIO *stdio)