]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD/MINOR: tools: rename popcount to my_popcountl
authorDavid Carlier <devnexen@gmail.com>
Thu, 2 Jul 2015 07:00:17 +0000 (07:00 +0000)
committerWilly Tarreau <w@1wt.eu>
Thu, 2 Jul 2015 09:32:25 +0000 (11:32 +0200)
This is in order to avoid conflicting with NetBSD popcount* functions
since 6.x release, the final l to mentions the argument is a long like
NetBSD does.

This patch could be backported to 1.5 to fix the build issue there as well.

include/common/standard.h
src/cfgparse.c

index df2444d3350b413e6b5b5c34487f172da5788c63..ec566544b9a24b246232955d2de26aab3713133a 100644 (file)
@@ -621,8 +621,8 @@ static inline unsigned int div64_32(unsigned long long o1, unsigned int o2)
        return result;
 }
 
-/* Simple popcount implementation. It returns the number of ones in a word */
-static inline unsigned int popcount(unsigned long a)
+/* Simple popcountl implementation. It returns the number of ones in a word */
+static inline unsigned int my_popcountl(unsigned long a)
 {
        unsigned int cnt;
        for (cnt = 0; a; a >>= 1) {
@@ -632,7 +632,7 @@ static inline unsigned int popcount(unsigned long a)
        return cnt;
 }
 
-/* Build a word with the <bits> lower bits set (reverse of popcount) */
+/* Build a word with the <bits> lower bits set (reverse of my_popcountl) */
 static inline unsigned long nbits(int bits)
 {
        if (--bits < 0)
index 031fbbfde42600ce71ec16ba1302507909dd5be9..4015804918cfb73c0dd95a240b6e501ec4e65045 100644 (file)
@@ -7211,7 +7211,7 @@ int check_config_validity()
                        /* an explicit bind-process was specified, let's check how many
                         * processes remain.
                         */
-                       nbproc = popcount(curproxy->bind_proc);
+                       nbproc = my_popcountl(curproxy->bind_proc);
 
                        curproxy->bind_proc &= nbits(global.nbproc);
                        if (!curproxy->bind_proc && nbproc == 1) {
@@ -7236,7 +7236,7 @@ int check_config_validity()
                                mask &= curproxy->bind_proc;
                        /* mask cannot be null here thanks to the previous checks */
 
-                       nbproc = popcount(bind_conf->bind_proc);
+                       nbproc = my_popcountl(bind_conf->bind_proc);
                        bind_conf->bind_proc &= mask;
 
                        if (!bind_conf->bind_proc && nbproc == 1) {
@@ -8322,7 +8322,7 @@ out_uri_auth_compat:
                                mask &= bind_conf->bind_proc;
 
                        /* stop here if more than one process is used */
-                       if (popcount(mask) > 1)
+                       if (my_popcountl(mask) > 1)
                                break;
                }
                if (&bind_conf->by_fe != &global.stats_fe->conf.bind) {
@@ -8385,7 +8385,7 @@ out_uri_auth_compat:
                unsigned int next_id;
                int nbproc;
 
-               nbproc = popcount(curproxy->bind_proc & nbits(global.nbproc));
+               nbproc = my_popcountl(curproxy->bind_proc & nbits(global.nbproc));
 
 #ifdef USE_OPENSSL
                /* Configure SSL for each bind line.
@@ -8513,7 +8513,7 @@ out_uri_auth_compat:
                                int count, maxproc = 0;
 
                                list_for_each_entry(bind_conf, &curproxy->conf.bind, by_fe) {
-                                       count = popcount(bind_conf->bind_proc);
+                                       count = my_popcountl(bind_conf->bind_proc);
                                        if (count > maxproc)
                                                maxproc = count;
                                }
@@ -8652,13 +8652,13 @@ out_uri_auth_compat:
                                Warning("Removing incomplete section 'peers %s' (no peer named '%s').\n",
                                        curpeers->id, localpeer);
                        }
-                       else if (popcount(curpeers->peers_fe->bind_proc) != 1) {
+                       else if (my_popcountl(curpeers->peers_fe->bind_proc) != 1) {
                                /* either it's totally stopped or too much used */
                                if (curpeers->peers_fe->bind_proc) {
                                        Alert("Peers section '%s': peers referenced by sections "
                                              "running in different processes (%d different ones). "
                                              "Check global.nbproc and all tables' bind-process "
-                                             "settings.\n", curpeers->id, popcount(curpeers->peers_fe->bind_proc));
+                                             "settings.\n", curpeers->id, my_popcountl(curpeers->peers_fe->bind_proc));
                                        cfgerr++;
                                }
                                stop_proxy(curpeers->peers_fe);