Module: kamailio
Branch: master
Commit: ac4fa1129f5fbd1a48aad1b7dc21a2c130ecd164
URL:
https://github.com/kamailio/kamailio/commit/ac4fa1129f5fbd1a48aad1b7dc21a2c…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-12-21T16:05:04+01:00
tmx: use unsigned for bitwise operations
---
Modified: src/modules/tmx/tmx_pretran.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ac4fa1129f5fbd1a48aad1b7dc21a2c…
Patch:
https://github.com/kamailio/kamailio/commit/ac4fa1129f5fbd1a48aad1b7dc21a2c…
---
diff --git a/src/modules/tmx/tmx_pretran.c b/src/modules/tmx/tmx_pretran.c
index dcaebd1f41b..7600a3c7b4b 100644
--- a/src/modules/tmx/tmx_pretran.c
+++ b/src/modules/tmx/tmx_pretran.c
@@ -72,19 +72,20 @@ static int _tmx_ptran_size = 0;
*/
int tmx_init_pretran_table(void)
{
- int n;
- int pn;
+ unsigned int n;
+ unsigned int pn;
- pn = get_max_procs();
+ pn = (unsigned int)get_max_procs();
- if(pn <= 0)
+ if(pn == 0)
return -1;
if(_tmx_ptran_table != NULL)
return -1;
+ n = 1;
/* get the highest power of two less than number of processes */
- n = -1;
- while(pn >> ++n > 0)
- ;
+ while((pn >> n) > 0) {
+ n++;
+ }
n--;
if(n <= 1)
n = 2;