From 09bc3ffc8734cf2437e14ab123c7b732db53b836 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 2 Oct 2025 12:16:29 +0200 Subject: Rename a handful of global constants --- src/sp_config.h | 4 ++-- src/sp_config_keywords.c | 4 ++-- src/sp_ini.c | 2 +- src/sp_utils.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sp_config.h b/src/sp_config.h index fb25fdb..6bfb009 100644 --- a/src/sp_config.h +++ b/src/sp_config.h @@ -19,9 +19,9 @@ typedef enum { SP_PHP_TYPE_REFERENCE = IS_REFERENCE } sp_php_type; -typedef enum { SP_ZEND = 0, SP_SYSLOG = 1 } sp_log_media; +typedef enum { SP_LOG_ZEND = 0, SP_LOG_SYSLOG = 1 } sp_log_media; -typedef enum { SP_UNSET = 0, SP_READONLY = 1, SP_READWRITE = -1 } sp_ini_permission; +typedef enum { SP_INI_UNSET = 0, SP_INI_READONLY = 1, SP_INI_READWRITE = -1 } sp_ini_permission; typedef struct { int ip_version; diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c index 796b44b..a5b4c5d 100644 --- a/src/sp_config_keywords.c +++ b/src/sp_config_keywords.c @@ -60,11 +60,11 @@ SP_PARSEKW_FN(parse_log_media) { SP_PARSE_ARG(value); if (!strcmp(ZSTR_VAL(value), "php")) { - *(char*)retval = SP_ZEND; + *(char*)retval = SP_LOG_ZEND; zend_string_release_ex(value, 1); return SP_PARSER_SUCCESS; } else if (!strcmp(ZSTR_VAL(value), "syslog")) { - *(char*)retval = SP_SYSLOG; + *(char*)retval = SP_LOG_SYSLOG; zend_string_release_ex(value, 1); return SP_PARSER_SUCCESS; } diff --git a/src/sp_ini.c b/src/sp_ini.c index cfbc615..2529760 100644 --- a/src/sp_ini.c +++ b/src/sp_ini.c @@ -1,7 +1,7 @@ #include "php_snuffleupagus.h" #define SP_INI_HAS_CHECKS_COND(entry) (entry->min || entry->max || entry->regexp) -#define SP_INI_ACCESS_READONLY_COND(entry, cfg) (entry->access == SP_READONLY || (!entry->access && cfg->policy_readonly)) +#define SP_INI_ACCESS_READONLY_COND(entry, cfg) (entry->access == SP_INI_READONLY || (!entry->access && cfg->policy_readonly)) #define sp_log_auto2(feature, is_simulation, drop, ...) \ sp_log_msgf(feature, ((is_simulation || !drop) ? SP_LOG_WARN : SP_LOG_ERROR), \ diff --git a/src/sp_utils.c b/src/sp_utils.c index 64de467..b045f61 100644 --- a/src/sp_utils.c +++ b/src/sp_utils.c @@ -44,7 +44,7 @@ void sp_log_msgf(char const* const restrict feature, int level, int type, } switch (SPCFG(log_media)) { - case SP_SYSLOG: { + case SP_LOG_SYSLOG: { const char* error_filename = zend_get_executed_filename(); int syslog_level = (level == E_ERROR) ? LOG_ERR : LOG_INFO; int error_lineno = zend_get_executed_lineno(TSRMLS_C); @@ -58,7 +58,7 @@ void sp_log_msgf(char const* const restrict feature, int level, int type, } break; } - case SP_ZEND: + case SP_LOG_ZEND: default: zend_error(level, "[snuffleupagus][%s][%s][%s] %s", client_ip, feature, logtype, msg); -- cgit v1.3