]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: config: Return ERR_NONE from config callbacks instead of 0
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 6 Nov 2020 14:24:23 +0000 (15:24 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 13 Nov 2020 15:26:10 +0000 (16:26 +0100)
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.

12 files changed:
src/51d.c
src/cache.c
src/check.c
src/da.c
src/debug.c
src/filters.c
src/http_htx.c
src/sink.c
src/ssl_sock.c
src/tcpcheck.c
src/wdt.c
src/wurfl.c

index 483a17b4ba66f9fc999f5a1540be5948563099c8..31d7c3f592a873bc7369ab9da89fc2b50a97e6ad 100644 (file)
--- a/src/51d.c
+++ b/src/51d.c
@@ -625,7 +625,7 @@ static int init_51degrees(void)
        fiftyoneDegreesDataSetInitStatus _51d_dataset_status = DATA_SET_INIT_STATUS_NOT_SET;
 
        if (!global_51degrees.data_file_path)
-               return 0;
+               return ERR_NONE;
 
        if (global.nbthread < 1) {
                ha_alert("51Degrees: The thread count cannot be zero or negative.\n");
@@ -708,7 +708,7 @@ static int init_51degrees(void)
        }
 #endif
 
-       return 0;
+       return ERR_NONE;
 }
 
 static void deinit_51degrees(void)
index 4f8fad98624d0807906bb03dc1019ccf368ac4a3..bd77a6ce3cadb5fb9ca18bc643d40d35c0c3890b 100644 (file)
@@ -1533,7 +1533,7 @@ int post_check_cache()
        struct cache *back, *cache_config, *cache;
        struct shared_context *shctx;
        int ret_shctx;
-       int err_code = 0;
+       int err_code = ERR_NONE;
 
        list_for_each_entry_safe(cache_config, back, &caches_config, list) {
 
index 63869b9d40c1e90ba89d631444c01a1614930f1f..315bc873f64c5612fee46d1c77ee3f94cd7bbb62 100644 (file)
@@ -1142,7 +1142,7 @@ static int start_checks()
        }
 
        if (!nbcheck)
-               return 0;
+               return ERR_NONE;
 
        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;
        struct tcpcheck_rule *r;
-       int ret = 0;
+       int ret = ERR_NONE;
        int check_type;
 
        if (!srv->do_check)
@@ -1353,7 +1353,7 @@ static int init_srv_agent_check(struct server *srv)
 {
        struct tcpcheck_rule *chk;
        const char *err;
-       int ret = 0;
+       int ret = ERR_NONE;
 
        if (!srv->do_agent)
                goto out;
index 98dbe6c877eb27efe5a78a73f2663f0c5710f034..c11e0766eefa6b611e3b5b4740d0a7c199ad640e 100644 (file)
--- a/src/da.c
+++ b/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)
 {
-       int err_code = 0;
+       int err_code = ERR_NONE;
 
        if (global_deviceatlas.jsonpath != 0) {
                FILE *jsonp;
index b2a4c6bacb643f6f3d3ffcb8c3a1af960aa2262a..7f2d16795e31709ca59faeb94651769580b20b4a 100644 (file)
@@ -894,7 +894,7 @@ static int init_debug()
        sigemptyset(&sa.sa_mask);
        sa.sa_flags = SA_SIGINFO;
        sigaction(DEBUGSIG, &sa, NULL);
-       return 0;
+       return ERR_NONE;
 }
 
 REGISTER_POST_CHECK(init_debug);
index d18f7733234fa5efe5f25dcdb102b9e6d126165d..1b954d87d0e97e1f76769354f3890136f442d710 100644 (file)
@@ -288,7 +288,7 @@ static int
 flt_init_all()
 {
        struct proxy *px;
-       int err_code = 0;
+       int err_code = ERR_NONE;
 
        for (px = proxies_list; px; px = px->next) {
                if (px->disabled) {
index d3c3f42a4655882cdd12fda48bfdf9d4c8d72c8d..b27b0836c669144da3b0af425b2485885f2f97f5 100644 (file)
@@ -2005,7 +2005,7 @@ static int proxy_check_errors(struct proxy *px)
 {
        struct conf_errors *conf_err, *conf_err_back;
        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) {
                if (conf_err->type == 1) {
@@ -2061,7 +2061,7 @@ static int post_check_errors()
        struct ebpt_node *node;
        struct http_error_msg *http_errmsg;
        struct htx *htx;
-       int err_code = 0;
+       int err_code = ERR_NONE;
 
        node = ebpt_first(&http_error_messages);
        while (node) {
index b87ea288c8a3a3b0fc4eeb1e511da21d80c65be9..09a302633f82f903769b9523304574279d4d0743 100644 (file)
@@ -972,7 +972,7 @@ int cfg_post_parse_ring()
 */
 int post_sink_resolve()
 {
-       int err_code = 0;
+       int err_code = ERR_NONE;
        struct logsrv *logsrv, *logb;
        struct sink *sink;
        struct proxy *px;
index 9072752f2d361a1687a159095316741a91331192..39a00d8430a505540961c5f301d4de33e8179322 100644 (file)
@@ -612,7 +612,7 @@ static int ssl_sock_register_msg_callbacks(void)
        }
 #endif
 
-       return 0;
+       return ERR_NONE;
 }
 
 /* Used to free all SSL/TLS protocol message callbacks that were
@@ -1245,7 +1245,7 @@ static int tlskeys_finalize_config(void)
        /* swap root */
        LIST_ADD(&tkr, &tlskeys_reference);
        LIST_DEL(&tkr);
-       return 0;
+       return ERR_NONE;
 }
 #endif /* SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB */
 
@@ -6306,7 +6306,7 @@ void ssl_free_global_issuers(void)
 
 #ifndef OPENSSL_NO_ENGINE
 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)) {
                ha_alert("ssl-mode-async only supports a maximum of 32 engines.\n");
index 75d97f3df7cb9924e289eb8d0cd160be44e784c5..3ecb0ba5436f562b290e0a8d06edd28859c3887d 100644 (file)
@@ -3470,7 +3470,7 @@ static int check_proxy_tcpcheck(struct proxy *px)
        struct tcpcheck_rule *chk, *back;
        char *comment = NULL, *errmsg = NULL;
        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) {
                deinit_proxy_tcpcheck(px);
index d6a3e56a93d926552af55c944d700937b3480751..18836ff440607bd5d6d64eb5d237809ea7118038 100644 (file)
--- a/src/wdt.c
+++ b/src/wdt.c
@@ -174,7 +174,7 @@ int init_wdt()
        sigemptyset(&sa.sa_mask);
        sa.sa_flags = SA_SIGINFO;
        sigaction(WDTSIG, &sa, NULL);
-       return 0;
+       return ERR_NONE;
 }
 
 REGISTER_POST_CHECK(init_wdt);
index 06029aacbf3b8378b2779717bb5718e130d3580c..34075d6c052530099ddf463c9d8b6fa28727831b 100644 (file)
@@ -263,7 +263,7 @@ static int ha_wurfl_init(void)
        // wurfl-data-file not configured, WURFL is not used so don't try to
        // configure it.
        if (global_wurfl.data_file == NULL)
-               return 0;
+               return ERR_NONE;
 
        ha_notice("WURFL: Loading module v.%s\n", HA_WURFL_MODULE_VERSION);
        // creating WURFL handler
@@ -395,7 +395,7 @@ static int ha_wurfl_init(void)
 
        ha_notice("WURFL: Engine loaded\n");
        ha_notice("WURFL: Module load completed\n");
-       return 0;
+       return ERR_NONE;
 }
 
 static void ha_wurfl_deinit(void)