From 51818120658381d5a567e9a7ec9050611ed721cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Fri, 8 Dec 2023 02:57:13 +0000 Subject: [PATCH] Removed redundant near_pow_2() --- lib/MySQL_Thread.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/MySQL_Thread.cpp b/lib/MySQL_Thread.cpp index 4124329551..7d23b6b207 100644 --- a/lib/MySQL_Thread.cpp +++ b/lib/MySQL_Thread.cpp @@ -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)); @@ -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));