squareball 0.2.0.28-7bb8 A general-purpose library for C99

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

All Data Structures Files Functions Variables Typedefs
sb-error.h
Go to the documentation of this file.
1 /*
2 * squareball: A general-purpose library for C99.
3 * Copyright (C) 2014-2018 Rafael G. Martins <rafael@rafaelmartins.eng.br>
4 *
5 * This program can be distributed under the terms of the BSD License.
6 * See the file LICENSE.
7 */
8
9 #ifndef _SQUAREBALL_ERROR_H
10 #define _SQUAREBALL_ERROR_H
11
12 #include <stdarg.h>
13 #include <stdlib.h>
14
30 typedef struct {
31
39 int code;
40
44 char *msg;
45
46 } sb_error_t;
47
55 enum {
56 SB_ERROR_FILE_OPEN = -1,
57 SB_ERROR_FILE_READ = -2,
58 SB_ERROR_FILE_WRITE = -3,
59 SB_ERROR_DIR_CREATE = -4,
60
61 SB_ERROR_CONFIGPARSER = -10,
62 };
63
71 sb_error_t* sb_error_new(int code, const char *msg);
72
82 sb_error_t* sb_error_new_printf(int code, const char *format, ...);
83
96 sb_error_t* sb_error_new_printf_parser(int code, const char *src, size_t src_len,
97 size_t current, const char *format, ...);
98
104 void sb_error_free(sb_error_t *err);
105
108 #endif /* _SQUAREBALL_ERROR_H */
sb_error_t::msg
char * msg
Definition: sb-error.h:44
sb_error_t::code
int code
Definition: sb-error.h:39
sb_error_new
sb_error_t * sb_error_new(int code, const char *msg)
sb_error_new_printf
sb_error_t * sb_error_new_printf(int code, const char *format,...)
sb_error_new_printf_parser
sb_error_t * sb_error_new_printf_parser(int code, const char *src, size_t src_len, size_t current, const char *format,...)
sb_error_free
void sb_error_free(sb_error_t *err)
sb_error_t
Definition: sb-error.h:30