23 #define TIME_FILE_LINE_FUNC_STR "%lld [%s: %d] %s(): ", lg_log_time(), __FILE__ , __LINE__, __func__
25 #define INFO_ERR2(...) \
27 fprintf(STD_ERR, TIME_FILE_LINE_FUNC_STR);\
28 fprintf(STD_ERR, __VA_ARGS__);\
33#define LG_ERR_CTX_FILE_MAXLEN 63
34#define LG_ERR_CTX_FUNC_MAXLEN 63
35#define LG_ERR_CTX_TXT_MAXLEN 1023
36#define LG_ERR_CTX_CODE_NA (-100000)
37#define LG_ERR_CTX_STR_MAXLEN 2048
38#define LG_ERR_CTX_FORMAT "[%s: %d] %s(): %s (code = %d)"
41 char file[LG_ERR_CTX_FILE_MAXLEN + 1];
43 char func[LG_ERR_CTX_FUNC_MAXLEN + 1];
44 char txt[LG_ERR_CTX_TXT_MAXLEN + 1];
48enum {OOM_MALLOC2_TEST, OOM_MALLOC3_TEST, OOM_MALLOC3_TEST2, INVPTR_FREE2_TEST, INVPTR_FREE3_TEST, SEGFAULT_TEST, DIVBYZERO_TEST};
69void *
malloc2_plus(
size_t,
const char *,
unsigned int,
const char *);
70#define malloc3(...) malloc2_plus(__VA_ARGS__, __FILE__, __LINE__, __func__)
73#define realloc3 realloc2
75#define calloc3 calloc2
77void free2_plus(
void *,
const char *,
unsigned int,
const char *);
81#define free2_ultimate(...) free2_plus(__VA_ARGS__, __FILE__, __LINE__, __func__)
82#define free3(mem_block) {free2_ultimate(mem_block); mem_block = NULL;}
87#define l_str_free2(string) {l_str_free(string); string = NULL;}
93int mkdir_plus(
const char *, mode_t,
const char *,
unsigned int,
const char *);
95#define mkdir_2(...) mkdir(__VA_ARGS__)
98FILE *
fopen_plus(
const char *,
const char *,
const char *,
unsigned int,
const char *);
100#define fopen_2(...) fopen(__VA_ARGS__)
114extern void app_sig_handler(
int,
const char *);
void free_v2(void **mem)
Definition lg_error.c:308
void set_sig_handler()
Definition lg_error.c:423
void lg_set_error_context(const char *file, unsigned int line, const char *func, const char *txt, int code)
Definition lg_error.c:147
const char * lg_get_full_error_context()
Definition lg_error.c:171
FILE * fopen_plus(const char *path, const char *mode, const char *file, unsigned int line, const char *func)
Definition lg_error.c:342
void lg_override_warning_timeout(int timeout)
Definition lg_error.c:119
void free2_plus(void *mem, const char *file, unsigned int line, const char *func)
Definition lg_error.c:280
void lg_clear_error_context()
Definition lg_error.c:184
void * malloc2_plus(size_t size, const char *file, unsigned int line, const char *func)
Definition lg_error.c:257
int lg_get_error_context_code()
Definition lg_error.c:161
void sig_handler(int sig_num, siginfo_t *sig_info, void *context)
Definition lg_error.c:396
void test_big_error(int test)
Definition lg_error.c:501
void lg_print_out_error_codes()
Definition lg_error.c:479
int mkdir_plus(const char *path, mode_t mode, const char *file, unsigned int line, const char *func)
Definition lg_error.c:323
long long lg_log_time()
Definition lg_error.c:135
void lg_reset_warning_timeout()
Definition lg_error.c:127
void lg_restore_error_context(LG_ErrorContext *err_ctx)
Definition lg_error.c:208
void lg_save_error_context(LG_ErrorContext *err_ctx)
Definition lg_error.c:200