diff options
| author | Christian Göttsche | 2024-06-06 16:36:40 +0200 |
|---|---|---|
| committer | jvoisin | 2024-06-06 16:36:40 +0200 |
| commit | 849252c6a48b428dde3ad8930b40a2bdf9874cb7 (patch) | |
| tree | 0fdc4d1e65c0f4fb4f670b95390c41be808b1ad1 /src/sp_utils.h | |
| parent | 381aa67af284e421ce6554e7bf6039dda5e674b9 (diff) | |
Add format attribute to log function and adjust format specifiers
Annotate the common logging function sp_log_msgf() with the format
attribute so compilers can check the used format string and passed
arguments for discrepancies.
Adjust the lineno printing by using %zu and the type size_t
consistently.
Diffstat (limited to 'src/sp_utils.h')
| -rw-r--r-- | src/sp_utils.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/sp_utils.h b/src/sp_utils.h index 36caa52..1146db3 100644 --- a/src/sp_utils.h +++ b/src/sp_utils.h | |||
| @@ -71,6 +71,11 @@ extern int sp_debug_stderr; | |||
| 71 | #define GET_SUFFIX(x) (x == 1) ? "st" : ((x == 2) ? "nd" : "th") | 71 | #define GET_SUFFIX(x) (x == 1) ? "st" : ((x == 2) ? "nd" : "th") |
| 72 | 72 | ||
| 73 | const char *get_ipaddr(void); | 73 | const char *get_ipaddr(void); |
| 74 | #if defined __has_attribute | ||
| 75 | # if __has_attribute (__format__) | ||
| 76 | __attribute__((__format__(printf, 4, 5))) | ||
| 77 | # endif | ||
| 78 | #endif | ||
| 74 | void sp_log_msgf(char const* const restrict feature, int level, int type, char const* const restrict fmt, ...); | 79 | void sp_log_msgf(char const* const restrict feature, int level, int type, char const* const restrict fmt, ...); |
| 75 | int compute_hash(char const* const restrict filename, char *restrict file_hash); | 80 | int compute_hash(char const* const restrict filename, char *restrict file_hash); |
| 76 | const zend_string *sp_zval_to_zend_string(const zval *); | 81 | const zend_string *sp_zval_to_zend_string(const zval *); |
