mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
BUILD/MINOR: tools: rename popcount to my_popcountl
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.
This commit is contained in:
parent
ae6d39af9c
commit
e6c3941668
@ -621,8 +621,8 @@ static inline unsigned int div64_32(unsigned long long o1, unsigned int o2)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Simple popcount implementation. It returns the number of ones in a word */
|
/* Simple popcountl implementation. It returns the number of ones in a word */
|
||||||
static inline unsigned int popcount(unsigned long a)
|
static inline unsigned int my_popcountl(unsigned long a)
|
||||||
{
|
{
|
||||||
unsigned int cnt;
|
unsigned int cnt;
|
||||||
for (cnt = 0; a; a >>= 1) {
|
for (cnt = 0; a; a >>= 1) {
|
||||||
@ -632,7 +632,7 @@ static inline unsigned int popcount(unsigned long a)
|
|||||||
return cnt;
|
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)
|
static inline unsigned long nbits(int bits)
|
||||||
{
|
{
|
||||||
if (--bits < 0)
|
if (--bits < 0)
|
||||||
|
@ -7211,7 +7211,7 @@ int check_config_validity()
|
|||||||
/* an explicit bind-process was specified, let's check how many
|
/* an explicit bind-process was specified, let's check how many
|
||||||
* processes remain.
|
* processes remain.
|
||||||
*/
|
*/
|
||||||
nbproc = popcount(curproxy->bind_proc);
|
nbproc = my_popcountl(curproxy->bind_proc);
|
||||||
|
|
||||||
curproxy->bind_proc &= nbits(global.nbproc);
|
curproxy->bind_proc &= nbits(global.nbproc);
|
||||||
if (!curproxy->bind_proc && nbproc == 1) {
|
if (!curproxy->bind_proc && nbproc == 1) {
|
||||||
@ -7236,7 +7236,7 @@ int check_config_validity()
|
|||||||
mask &= curproxy->bind_proc;
|
mask &= curproxy->bind_proc;
|
||||||
/* mask cannot be null here thanks to the previous checks */
|
/* 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;
|
bind_conf->bind_proc &= mask;
|
||||||
|
|
||||||
if (!bind_conf->bind_proc && nbproc == 1) {
|
if (!bind_conf->bind_proc && nbproc == 1) {
|
||||||
@ -8322,7 +8322,7 @@ out_uri_auth_compat:
|
|||||||
mask &= bind_conf->bind_proc;
|
mask &= bind_conf->bind_proc;
|
||||||
|
|
||||||
/* stop here if more than one process is used */
|
/* stop here if more than one process is used */
|
||||||
if (popcount(mask) > 1)
|
if (my_popcountl(mask) > 1)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (&bind_conf->by_fe != &global.stats_fe->conf.bind) {
|
if (&bind_conf->by_fe != &global.stats_fe->conf.bind) {
|
||||||
@ -8385,7 +8385,7 @@ out_uri_auth_compat:
|
|||||||
unsigned int next_id;
|
unsigned int next_id;
|
||||||
int nbproc;
|
int nbproc;
|
||||||
|
|
||||||
nbproc = popcount(curproxy->bind_proc & nbits(global.nbproc));
|
nbproc = my_popcountl(curproxy->bind_proc & nbits(global.nbproc));
|
||||||
|
|
||||||
#ifdef USE_OPENSSL
|
#ifdef USE_OPENSSL
|
||||||
/* Configure SSL for each bind line.
|
/* Configure SSL for each bind line.
|
||||||
@ -8513,7 +8513,7 @@ out_uri_auth_compat:
|
|||||||
int count, maxproc = 0;
|
int count, maxproc = 0;
|
||||||
|
|
||||||
list_for_each_entry(bind_conf, &curproxy->conf.bind, by_fe) {
|
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)
|
if (count > maxproc)
|
||||||
maxproc = count;
|
maxproc = count;
|
||||||
}
|
}
|
||||||
@ -8652,13 +8652,13 @@ out_uri_auth_compat:
|
|||||||
Warning("Removing incomplete section 'peers %s' (no peer named '%s').\n",
|
Warning("Removing incomplete section 'peers %s' (no peer named '%s').\n",
|
||||||
curpeers->id, localpeer);
|
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 */
|
/* either it's totally stopped or too much used */
|
||||||
if (curpeers->peers_fe->bind_proc) {
|
if (curpeers->peers_fe->bind_proc) {
|
||||||
Alert("Peers section '%s': peers referenced by sections "
|
Alert("Peers section '%s': peers referenced by sections "
|
||||||
"running in different processes (%d different ones). "
|
"running in different processes (%d different ones). "
|
||||||
"Check global.nbproc and all tables' bind-process "
|
"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++;
|
cfgerr++;
|
||||||
}
|
}
|
||||||
stop_proxy(curpeers->peers_fe);
|
stop_proxy(curpeers->peers_fe);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user