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:
David Carlier 2015-07-02 07:00:17 +00:00 committed by Willy Tarreau
parent ae6d39af9c
commit e6c3941668
2 changed files with 10 additions and 10 deletions

View 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)

View 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 @@ int check_config_validity()
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 @@ int check_config_validity()
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 @@ int check_config_validity()
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 @@ int check_config_validity()
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);