Libevhtp  1.2.13
internal.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define evhtp_likely(x)   (x)
 
#define evhtp_unlikely(x)   (x)
 
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
 
#define __FILENAME__
 
#define clean_errno()   (errno == 0 ? "None" : strerror(errno))
 
#define __log_debug_color(X)   "[\x1b[1;36m" X "\x1b[0;39m]"
 
#define __log_error_color(X)   "[\x1b[1;31m" X "\x1b[0;39m]"
 
#define __log_warn_color(X)   "[\x1b[1;33m" X "\x1b[0;39m]"
 
#define __log_info_color(X)   "[\x1b[32m" X "\x1b[0;39m]"
 
#define __log_func_color(X)   "\x1b[33m" X "\x1b[39m"
 
#define __log_args_color(X)   "\x1b[94m" X "\x1b[39m"
 
#define __log_errno_color(X)   "\x1b[35m" X "\x1b[39m"
 
#define log_debug(M, ...)
 
#define log_error(M, ...)
 
#define log_warn(M, ...)
 
#define log_info(M, ...)
 
#define evhtp_assert(x)
 
#define evhtp_alloc_assert(x)
 
#define evhtp_assert_fmt(x, fmt, ...)
 
#define evhtp_errno_assert(x)
 

Macro Definition Documentation

◆ __FILENAME__

#define __FILENAME__
Value:
(strrchr(__FILE__, '/') ? \
strrchr(__FILE__, '/') + 1 : __FILE__)

Definition at line 29 of file internal.h.

◆ __log_args_color

#define __log_args_color (   X)    "\x1b[94m" X "\x1b[39m"

Definition at line 41 of file internal.h.

◆ __log_debug_color

#define __log_debug_color (   X)    "[\x1b[1;36m" X "\x1b[0;39m]"

Definition at line 36 of file internal.h.

◆ __log_errno_color

#define __log_errno_color (   X)    "\x1b[35m" X "\x1b[39m"

Definition at line 42 of file internal.h.

◆ __log_error_color

#define __log_error_color (   X)    "[\x1b[1;31m" X "\x1b[0;39m]"

Definition at line 37 of file internal.h.

◆ __log_func_color

#define __log_func_color (   X)    "\x1b[33m" X "\x1b[39m"

Definition at line 40 of file internal.h.

◆ __log_info_color

#define __log_info_color (   X)    "[\x1b[32m" X "\x1b[0;39m]"

Definition at line 39 of file internal.h.

◆ __log_warn_color

#define __log_warn_color (   X)    "[\x1b[1;33m" X "\x1b[0;39m]"

Definition at line 38 of file internal.h.

◆ clean_errno

#define clean_errno ( )    (errno == 0 ? "None" : strerror(errno))

Definition at line 33 of file internal.h.

◆ evhtp_alloc_assert

#define evhtp_alloc_assert (   x)
Value:
do { \
if (evhtp_unlikely(!x)) { \
fprintf(stderr, "Out of memory (%s:%s:%d)\n", \
__func__, __FILE__, __LINE__); \
fflush(stderr); \
abort(); \
} \
} while (0)

Definition at line 93 of file internal.h.

◆ evhtp_assert

#define evhtp_assert (   x)
Value:
do { \
if (evhtp_unlikely(!(x))) { \
fprintf(stderr, "Assertion failed: %s (%s:%s:%d)\n", # x, \
__func__, __FILE__, __LINE__); \
fflush(stderr); \
abort(); \
} \
} while (0)

Definition at line 83 of file internal.h.

◆ evhtp_assert_fmt

#define evhtp_assert_fmt (   x,
  fmt,
  ... 
)
Value:
do { \
if (evhtp_unlikely(!(x))) { \
fprintf(stderr, "Assertion failed: %s (%s:%s:%d) " fmt "\n", \
# x, __func__, __FILE__, __LINE__, __VA_ARGS__); \
fflush(stderr); \
abort(); \
} \
} while (0)

Definition at line 103 of file internal.h.

◆ evhtp_errno_assert

#define evhtp_errno_assert (   x)
Value:
do { \
if (evhtp_unlikely(!(x))) { \
fprintf(stderr, "%s [%d] (%s:%s:%d)\n", \
strerror(errno), errno, \
__func__, __FILE__, __LINE__); \
fflush(stderr); \
abort(); \
} \
} while (0)

Definition at line 113 of file internal.h.

◆ evhtp_likely

#define evhtp_likely (   x)    (x)

Definition at line 17 of file internal.h.

◆ evhtp_unlikely

#define evhtp_unlikely (   x)    (x)

Definition at line 18 of file internal.h.

◆ log_debug

#define log_debug (   M,
  ... 
)

Definition at line 47 of file internal.h.

◆ log_error

#define log_error (   M,
  ... 
)
Value:
fprintf(stderr, __log_error_color("ERROR") " " \
__log_func_color("%s:%-9d") \
" :: " \
__log_errno_color("(errno: %s)") \
"\n", \
__FILENAME__, __LINE__, ## __VA_ARGS__, clean_errno())

Definition at line 57 of file internal.h.

◆ log_info

#define log_info (   M,
  ... 
)
Value:
fprintf(stderr, __log_info_color("INFO") " " \
__log_func_color("%4s:%-9d") \
__log_args_color(M) "\n", \
__FILENAME__, __LINE__, ## __VA_ARGS__)

Definition at line 76 of file internal.h.

◆ log_warn

#define log_warn (   M,
  ... 
)
Value:
fprintf(stderr, __log_warn_color("WARN") " " \
__log_func_color("%s:%-9d") \
" :: " \
__log_errno_color("(errno: %s)") \
"\n", \
__FILENAME__, __LINE__, ## __VA_ARGS__, clean_errno())

Definition at line 67 of file internal.h.

◆ TAILQ_FOREACH_SAFE

#define TAILQ_FOREACH_SAFE (   var,
  head,
  field,
  tvar 
)
Value:
for ((var) = TAILQ_FIRST((head)); \
(var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
(var) = (tvar))

Definition at line 22 of file internal.h.

__log_args_color
#define __log_args_color(X)
Definition: internal.h:41
__log_info_color
#define __log_info_color(X)
Definition: internal.h:39
__log_errno_color
#define __log_errno_color(X)
Definition: internal.h:42
evhtp_unlikely
#define evhtp_unlikely(x)
Definition: internal.h:18
__FILENAME__
#define __FILENAME__
Definition: internal.h:29
__log_func_color
#define __log_func_color(X)
Definition: internal.h:40
clean_errno
#define clean_errno()
Definition: internal.h:33
__log_error_color
#define __log_error_color(X)
Definition: internal.h:37
__log_warn_color
#define __log_warn_color(X)
Definition: internal.h:38