squareball  0.2.0
A general-purpose library for C99
 All Data Structures Files Functions Variables Typedefs Pages
sb-error.h
Go to the documentation of this file.
1 /*
2  * squareball: A general-purpose library for C99.
3  * Copyright (C) 2015-2016 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 
29 typedef struct {
30 
38  int code;
39 
43  char *msg;
44 
45 } sb_error_t;
46 
54 enum {
55  SB_ERROR_FILE_OPEN = -1,
56  SB_ERROR_FILE_READ = -2,
57  SB_ERROR_FILE_WRITE = -3,
58  SB_ERROR_DIR_CREATE = -4,
59 };
60 
68 sb_error_t* sb_error_new(int code, const char *msg);
69 
79 sb_error_t* sb_error_new_printf(int code, const char *format, ...);
80 
86 void sb_error_free(sb_error_t *err);
87 
90 #endif /* _SQUAREBALL_ERROR_H */
char * msg
Definition: sb-error.h:43
int code
Definition: sb-error.h:38
sb_error_t * sb_error_new(int code, const char *msg)
sb_error_t * sb_error_new_printf(int code, const char *format,...)
void sb_error_free(sb_error_t *err)
Definition: sb-error.h:29