patty/include/patty/error.h
XANTRONIX Development 356b25fd94 Implement src/error.c
Implement src/error.c to provide the patty_error type, to allow easy
error string formatting, error state checking, and error clearing
2024-03-01 00:20:47 -05:00

24 lines
476 B
C

#ifndef _PATTY_ERROR_H
#define _PATTY_ERROR_H
#define PATTY_ERROR_STRLEN 256
enum patty_error_state {
PATTY_ERROR_OK,
PATTY_ERROR_SET
};
typedef struct _patty_error {
enum patty_error_state state;
char err[PATTY_ERROR_STRLEN];
} patty_error;
int patty_error_fmt(patty_error *e, const char *message, ...);
void patty_error_clear(patty_error *e);
int patty_error_set(patty_error *e);
char *patty_error_string(patty_error *e);
#endif /* _PATTY_ERROR_H */