Skip to content

Commit

Permalink
Removed redundant near_pow_2()
Browse files Browse the repository at this point in the history
  • Loading branch information
renecannao committed Dec 8, 2023
1 parent 699fe7e commit 5181812
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions lib/MySQL_Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,8 @@ volatile static unsigned int __global_MySQL_Thread_Variables_version;



static unsigned int near_pow_2 (unsigned int n) {
unsigned int i = 1;
while (i < n) i <<= 1;
return i ? i : n;
}


void ProxySQL_Poll::shrink() {
unsigned int new_size=near_pow_2(len+1);
unsigned int new_size=l_near_pow_2(len+1);
fds=(struct pollfd *)realloc(fds,new_size*sizeof(struct pollfd));
myds=(MySQL_Data_Stream **)realloc(myds,new_size*sizeof(MySQL_Data_Stream *));
last_recv=(unsigned long long *)realloc(last_recv,new_size*sizeof(unsigned long long));
Expand All @@ -151,7 +144,7 @@ void ProxySQL_Poll::shrink() {

void ProxySQL_Poll::expand(unsigned int more) {
if ( (len+more) > size ) {
unsigned int new_size=near_pow_2(len+more);
unsigned int new_size=l_near_pow_2(len+more);
fds=(struct pollfd *)realloc(fds,new_size*sizeof(struct pollfd));
myds=(MySQL_Data_Stream **)realloc(myds,new_size*sizeof(MySQL_Data_Stream *));
last_recv=(unsigned long long *)realloc(last_recv,new_size*sizeof(unsigned long long));
Expand Down

0 comments on commit 5181812

Please sign in to comment.