26 lines
970 B
C
26 lines
970 B
C
|
|
#ifndef _AKSL_INTERNAL_H_
|
||
|
|
#define _AKSL_INTERNAL_H_
|
||
|
|
|
||
|
|
/*
|
||
|
|
* Shared internals. Not installed, not part of the public API -- anything here
|
||
|
|
* is free to change without so much as a patch bump.
|
||
|
|
*/
|
||
|
|
|
||
|
|
#include <errno.h>
|
||
|
|
|
||
|
|
/*
|
||
|
|
* errno as an akerror status, with a fallback for when it is not one.
|
||
|
|
*
|
||
|
|
* A libc call is allowed to fail without touching errno -- malloc(0) may return
|
||
|
|
* NULL and leave it alone -- and errno may equally be a leftover from some
|
||
|
|
* earlier, unrelated, *successful* call. Reporting it raw produces a FAIL whose
|
||
|
|
* status is 0, which every downstream DETECT and CATCH reads as success while
|
||
|
|
* the context still holds a pool slot: an error that is invisible and leaks at
|
||
|
|
* the same time. Every errno-sourced status in this library goes through here,
|
||
|
|
* and every wrapped call clears errno first so the value read back is its own.
|
||
|
|
* TODO.md 2.2.1.
|
||
|
|
*/
|
||
|
|
#define AKSL_ERRNO_OR(__fallback) (errno != 0 ? errno : (__fallback))
|
||
|
|
|
||
|
|
#endif // _AKSL_INTERNAL_H_
|