summaryrefslogtreecommitdiff
path: root/src/sp_utils.h
diff options
context:
space:
mode:
authorjvoisin2020-11-06 17:05:58 +0100
committerjvoisin2020-11-06 17:05:58 +0100
commita480d9f70a99143dd16416da150cee1c21fdde1d (patch)
tree8ceff772a69aa41edb045210f7b7220a0e029b2b /src/sp_utils.h
parente6e6728fd04d7cbaeee7f8ef4733a77557786a8b (diff)
Clang-format again
Diffstat (limited to 'src/sp_utils.h')
-rw-r--r--src/sp_utils.h27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/sp_utils.h b/src/sp_utils.h
index 24571ee..24c74bf 100644
--- a/src/sp_utils.h
+++ b/src/sp_utils.h
@@ -36,17 +36,24 @@
36#define SP_LOG_ERROR E_ERROR 36#define SP_LOG_ERROR E_ERROR
37#define SP_LOG_WARN E_WARNING 37#define SP_LOG_WARN E_WARNING
38 38
39#define sp_log_msg(feature, level, ...) sp_log_msgf(feature, level, SP_TYPE_LOG, __VA_ARGS__) 39#define sp_log_msg(feature, level, ...) \
40#define sp_log_drop(feature, ...) sp_log_msgf(feature, SP_LOG_ERROR, SP_TYPE_DROP, __VA_ARGS__) 40 sp_log_msgf(feature, level, SP_TYPE_LOG, __VA_ARGS__)
41#define sp_log_simulation(feature, ...) sp_log_msgf(feature, SP_LOG_WARN, SP_TYPE_SIMULATION, __VA_ARGS__) 41#define sp_log_drop(feature, ...) \
42#define sp_log_auto(feature, is_simulation, ...) sp_log_msgf(feature, \ 42 sp_log_msgf(feature, SP_LOG_ERROR, SP_TYPE_DROP, __VA_ARGS__)
43 (is_simulation ? SP_LOG_WARN : SP_LOG_ERROR), \ 43#define sp_log_simulation(feature, ...) \
44 (is_simulation ? SP_TYPE_SIMULATION : SP_TYPE_DROP), __VA_ARGS__) 44 sp_log_msgf(feature, SP_LOG_WARN, SP_TYPE_SIMULATION, __VA_ARGS__)
45#define sp_log_auto(feature, is_simulation, ...) \
46 sp_log_msgf(feature, (is_simulation ? SP_LOG_WARN : SP_LOG_ERROR), \
47 (is_simulation ? SP_TYPE_SIMULATION : SP_TYPE_DROP), \
48 __VA_ARGS__)
45 49
46#define sp_log_err(feature, ...) sp_log_msgf(feature, SP_LOG_ERROR, SP_TYPE_LOG, __VA_ARGS__) 50#define sp_log_err(feature, ...) \
47#define sp_log_warn(feature, ...) sp_log_msgf(feature, SP_LOG_WARN, SP_TYPE_LOG, __VA_ARGS__) 51 sp_log_msgf(feature, SP_LOG_ERROR, SP_TYPE_LOG, __VA_ARGS__)
52#define sp_log_warn(feature, ...) \
53 sp_log_msgf(feature, SP_LOG_WARN, SP_TYPE_LOG, __VA_ARGS__)
48#ifdef SP_DEBUG 54#ifdef SP_DEBUG
49#define sp_log_debug(...) sp_log_msgf("DEBUG", SP_LOG_DEBUG, SP_TYPE_LOG, __VA_ARGS__) 55#define sp_log_debug(...) \
56 sp_log_msgf("DEBUG", SP_LOG_DEBUG, SP_TYPE_LOG, __VA_ARGS__)
50#else 57#else
51#define sp_log_debug(...) 58#define sp_log_debug(...)
52#endif 59#endif
@@ -55,7 +62,7 @@
55 62
56const char *get_ipaddr(void); 63const char *get_ipaddr(void);
57void sp_log_msgf(char const *restrict feature, int level, int type, 64void sp_log_msgf(char const *restrict feature, int level, int type,
58 const char *restrict fmt, ...); 65 const char *restrict fmt, ...);
59int compute_hash(const char *const restrict filename, char *restrict file_hash); 66int compute_hash(const char *const restrict filename, char *restrict file_hash);
60const zend_string *sp_zval_to_zend_string(const zval *); 67const zend_string *sp_zval_to_zend_string(const zval *);
61bool sp_match_value(const zend_string *, const zend_string *, const sp_pcre *); 68bool sp_match_value(const zend_string *, const zend_string *, const sp_pcre *);