mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 23:27:04 +02:00
CLEANUP: config: Return ERR_NONE from config callbacks instead of 0
Return ERR_NONE instead of 0 on success for all config callbacks that should return ERR_* codes. There is no change because ERR_NONE is a macro equals to 0. But this makes the return value more explicit.
This commit is contained in:
parent
5214099233
commit
fc633b6eff
@ -625,7 +625,7 @@ static int init_51degrees(void)
|
|||||||
fiftyoneDegreesDataSetInitStatus _51d_dataset_status = DATA_SET_INIT_STATUS_NOT_SET;
|
fiftyoneDegreesDataSetInitStatus _51d_dataset_status = DATA_SET_INIT_STATUS_NOT_SET;
|
||||||
|
|
||||||
if (!global_51degrees.data_file_path)
|
if (!global_51degrees.data_file_path)
|
||||||
return 0;
|
return ERR_NONE;
|
||||||
|
|
||||||
if (global.nbthread < 1) {
|
if (global.nbthread < 1) {
|
||||||
ha_alert("51Degrees: The thread count cannot be zero or negative.\n");
|
ha_alert("51Degrees: The thread count cannot be zero or negative.\n");
|
||||||
@ -708,7 +708,7 @@ static int init_51degrees(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deinit_51degrees(void)
|
static void deinit_51degrees(void)
|
||||||
|
@ -1533,7 +1533,7 @@ int post_check_cache()
|
|||||||
struct cache *back, *cache_config, *cache;
|
struct cache *back, *cache_config, *cache;
|
||||||
struct shared_context *shctx;
|
struct shared_context *shctx;
|
||||||
int ret_shctx;
|
int ret_shctx;
|
||||||
int err_code = 0;
|
int err_code = ERR_NONE;
|
||||||
|
|
||||||
list_for_each_entry_safe(cache_config, back, &caches_config, list) {
|
list_for_each_entry_safe(cache_config, back, &caches_config, list) {
|
||||||
|
|
||||||
|
@ -1142,7 +1142,7 @@ static int start_checks()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!nbcheck)
|
if (!nbcheck)
|
||||||
return 0;
|
return ERR_NONE;
|
||||||
|
|
||||||
srand((unsigned)time(NULL));
|
srand((unsigned)time(NULL));
|
||||||
|
|
||||||
@ -1180,7 +1180,7 @@ static int start_checks()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1227,7 +1227,7 @@ static int init_srv_check(struct server *srv)
|
|||||||
{
|
{
|
||||||
const char *err;
|
const char *err;
|
||||||
struct tcpcheck_rule *r;
|
struct tcpcheck_rule *r;
|
||||||
int ret = 0;
|
int ret = ERR_NONE;
|
||||||
int check_type;
|
int check_type;
|
||||||
|
|
||||||
if (!srv->do_check)
|
if (!srv->do_check)
|
||||||
@ -1353,7 +1353,7 @@ static int init_srv_agent_check(struct server *srv)
|
|||||||
{
|
{
|
||||||
struct tcpcheck_rule *chk;
|
struct tcpcheck_rule *chk;
|
||||||
const char *err;
|
const char *err;
|
||||||
int ret = 0;
|
int ret = ERR_NONE;
|
||||||
|
|
||||||
if (!srv->do_agent)
|
if (!srv->do_agent)
|
||||||
goto out;
|
goto out;
|
||||||
|
2
src/da.c
2
src/da.c
@ -119,7 +119,7 @@ static void da_haproxy_log(da_severity_t severity, da_status_t status,
|
|||||||
*/
|
*/
|
||||||
static int init_deviceatlas(void)
|
static int init_deviceatlas(void)
|
||||||
{
|
{
|
||||||
int err_code = 0;
|
int err_code = ERR_NONE;
|
||||||
|
|
||||||
if (global_deviceatlas.jsonpath != 0) {
|
if (global_deviceatlas.jsonpath != 0) {
|
||||||
FILE *jsonp;
|
FILE *jsonp;
|
||||||
|
@ -894,7 +894,7 @@ static int init_debug()
|
|||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
sa.sa_flags = SA_SIGINFO;
|
sa.sa_flags = SA_SIGINFO;
|
||||||
sigaction(DEBUGSIG, &sa, NULL);
|
sigaction(DEBUGSIG, &sa, NULL);
|
||||||
return 0;
|
return ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
REGISTER_POST_CHECK(init_debug);
|
REGISTER_POST_CHECK(init_debug);
|
||||||
|
@ -288,7 +288,7 @@ static int
|
|||||||
flt_init_all()
|
flt_init_all()
|
||||||
{
|
{
|
||||||
struct proxy *px;
|
struct proxy *px;
|
||||||
int err_code = 0;
|
int err_code = ERR_NONE;
|
||||||
|
|
||||||
for (px = proxies_list; px; px = px->next) {
|
for (px = proxies_list; px; px = px->next) {
|
||||||
if (px->disabled) {
|
if (px->disabled) {
|
||||||
|
@ -2005,7 +2005,7 @@ static int proxy_check_errors(struct proxy *px)
|
|||||||
{
|
{
|
||||||
struct conf_errors *conf_err, *conf_err_back;
|
struct conf_errors *conf_err, *conf_err_back;
|
||||||
struct http_errors *http_errs;
|
struct http_errors *http_errs;
|
||||||
int rc, err = 0;
|
int rc, err = ERR_NONE;
|
||||||
|
|
||||||
list_for_each_entry_safe(conf_err, conf_err_back, &px->conf.errors, list) {
|
list_for_each_entry_safe(conf_err, conf_err_back, &px->conf.errors, list) {
|
||||||
if (conf_err->type == 1) {
|
if (conf_err->type == 1) {
|
||||||
@ -2061,7 +2061,7 @@ static int post_check_errors()
|
|||||||
struct ebpt_node *node;
|
struct ebpt_node *node;
|
||||||
struct http_error_msg *http_errmsg;
|
struct http_error_msg *http_errmsg;
|
||||||
struct htx *htx;
|
struct htx *htx;
|
||||||
int err_code = 0;
|
int err_code = ERR_NONE;
|
||||||
|
|
||||||
node = ebpt_first(&http_error_messages);
|
node = ebpt_first(&http_error_messages);
|
||||||
while (node) {
|
while (node) {
|
||||||
|
@ -972,7 +972,7 @@ int cfg_post_parse_ring()
|
|||||||
*/
|
*/
|
||||||
int post_sink_resolve()
|
int post_sink_resolve()
|
||||||
{
|
{
|
||||||
int err_code = 0;
|
int err_code = ERR_NONE;
|
||||||
struct logsrv *logsrv, *logb;
|
struct logsrv *logsrv, *logb;
|
||||||
struct sink *sink;
|
struct sink *sink;
|
||||||
struct proxy *px;
|
struct proxy *px;
|
||||||
|
@ -612,7 +612,7 @@ static int ssl_sock_register_msg_callbacks(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Used to free all SSL/TLS protocol message callbacks that were
|
/* Used to free all SSL/TLS protocol message callbacks that were
|
||||||
@ -1245,7 +1245,7 @@ static int tlskeys_finalize_config(void)
|
|||||||
/* swap root */
|
/* swap root */
|
||||||
LIST_ADD(&tkr, &tlskeys_reference);
|
LIST_ADD(&tkr, &tlskeys_reference);
|
||||||
LIST_DEL(&tkr);
|
LIST_DEL(&tkr);
|
||||||
return 0;
|
return ERR_NONE;
|
||||||
}
|
}
|
||||||
#endif /* SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB */
|
#endif /* SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB */
|
||||||
|
|
||||||
@ -6306,7 +6306,7 @@ void ssl_free_global_issuers(void)
|
|||||||
|
|
||||||
#ifndef OPENSSL_NO_ENGINE
|
#ifndef OPENSSL_NO_ENGINE
|
||||||
static int ssl_check_async_engine_count(void) {
|
static int ssl_check_async_engine_count(void) {
|
||||||
int err_code = 0;
|
int err_code = ERR_NONE;
|
||||||
|
|
||||||
if (global_ssl.async && (openssl_engines_initialized > 32)) {
|
if (global_ssl.async && (openssl_engines_initialized > 32)) {
|
||||||
ha_alert("ssl-mode-async only supports a maximum of 32 engines.\n");
|
ha_alert("ssl-mode-async only supports a maximum of 32 engines.\n");
|
||||||
|
@ -3470,7 +3470,7 @@ static int check_proxy_tcpcheck(struct proxy *px)
|
|||||||
struct tcpcheck_rule *chk, *back;
|
struct tcpcheck_rule *chk, *back;
|
||||||
char *comment = NULL, *errmsg = NULL;
|
char *comment = NULL, *errmsg = NULL;
|
||||||
enum tcpcheck_rule_type prev_action = TCPCHK_ACT_COMMENT;
|
enum tcpcheck_rule_type prev_action = TCPCHK_ACT_COMMENT;
|
||||||
int ret = 0;
|
int ret = ERR_NONE;
|
||||||
|
|
||||||
if (!(px->cap & PR_CAP_BE) || (px->options2 & PR_O2_CHK_ANY) != PR_O2_TCPCHK_CHK) {
|
if (!(px->cap & PR_CAP_BE) || (px->options2 & PR_O2_CHK_ANY) != PR_O2_TCPCHK_CHK) {
|
||||||
deinit_proxy_tcpcheck(px);
|
deinit_proxy_tcpcheck(px);
|
||||||
|
@ -174,7 +174,7 @@ int init_wdt()
|
|||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
sa.sa_flags = SA_SIGINFO;
|
sa.sa_flags = SA_SIGINFO;
|
||||||
sigaction(WDTSIG, &sa, NULL);
|
sigaction(WDTSIG, &sa, NULL);
|
||||||
return 0;
|
return ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
REGISTER_POST_CHECK(init_wdt);
|
REGISTER_POST_CHECK(init_wdt);
|
||||||
|
@ -263,7 +263,7 @@ static int ha_wurfl_init(void)
|
|||||||
// wurfl-data-file not configured, WURFL is not used so don't try to
|
// wurfl-data-file not configured, WURFL is not used so don't try to
|
||||||
// configure it.
|
// configure it.
|
||||||
if (global_wurfl.data_file == NULL)
|
if (global_wurfl.data_file == NULL)
|
||||||
return 0;
|
return ERR_NONE;
|
||||||
|
|
||||||
ha_notice("WURFL: Loading module v.%s\n", HA_WURFL_MODULE_VERSION);
|
ha_notice("WURFL: Loading module v.%s\n", HA_WURFL_MODULE_VERSION);
|
||||||
// creating WURFL handler
|
// creating WURFL handler
|
||||||
@ -395,7 +395,7 @@ static int ha_wurfl_init(void)
|
|||||||
|
|
||||||
ha_notice("WURFL: Engine loaded\n");
|
ha_notice("WURFL: Engine loaded\n");
|
||||||
ha_notice("WURFL: Module load completed\n");
|
ha_notice("WURFL: Module load completed\n");
|
||||||
return 0;
|
return ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ha_wurfl_deinit(void)
|
static void ha_wurfl_deinit(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user