Hello list.
Compiling with 'clang-cl' on Windows-10, I saw this important warning: network.c(796,10): warning: variable 'counter' set but not used [-Wunused-but-set-variable] size_t* counter = (size_t*)data; ^
So shouldn't the function be:
static int __loc_network_tree_count(struct loc_network* network, void* data) { size_t* counter = (size_t*)data;
// Increase the counter for each network (*counter)++; return 0; }
But I fail to see this ret-val is used for anything.
BTW, disasm now is correct: inc qword ptr [rdx] xor eax,eax ret
Hello Gisle,
Thanks for your email.
On 4 Mar 2023, at 10:44, Gisle Vanem gvanem@online.no wrote:
Hello list.
Compiling with 'clang-cl' on Windows-10, I saw this important warning: network.c(796,10): warning: variable 'counter' set but not used [-Wunused-but-set-variable] size_t* counter = (size_t*)data; ^
So shouldn't the function be:
static int __loc_network_tree_count(struct loc_network* network, void* data) { size_t* counter = (size_t*)data;
// Increase the counter for each network (*counter)++; return 0;
Yes, you are incorrect. I am incrementing the pointer when I wanted to increment the value. Probably this is an artefact from rewriting the code a few times.
But indeed this has not been a problem since the function is not being called at all in the code, and it is not being exported.
So assuming that it is not very useful, I will drop loc_network_tree_count_networks and the callback function.
Thank you for helping to improve libloc. How does it run on Windows?
Best, -Michael
}
But I fail to see this ret-val is used for anything.
BTW, disasm now is correct: inc qword ptr [rdx] xor eax,eax ret
-- --gv
Michael Tremer wrote:
So shouldn't the function be:
static int __loc_network_tree_count(struct loc_network* network, void* data) { size_t* counter = (size_t*)data;
// Increase the counter for each network (*counter)++; return 0;
Yes, you are incorrect. I am incrementing the pointer when I wanted to increment the value.
You mean "you are correct"?
Thank you for helping to improve libloc. How does it run on Windows?
I doesn't run at all w/o much patching by myself. I've added support for it and 'location.db' files in my project Wsock-trace: https://github.com/gvanem/wsock-trace
The patched up 'libloc' version: https://github.com/gvanem/wsock-trace/tree/master/src/Geo-IP/IPFire/src
Hello,
On 4 Mar 2023, at 11:00, Gisle Vanem gvanem@online.no wrote:
Michael Tremer wrote:
So shouldn't the function be:
static int __loc_network_tree_count(struct loc_network* network, void* data) { size_t* counter = (size_t*)data;
// Increase the counter for each network (*counter)++; return 0;
Yes, you are incorrect. I am incrementing the pointer when I wanted to increment the value.
You mean "you are correct"?
Thank you for helping to improve libloc. How does it run on Windows?
I doesn't run at all w/o much patching by myself. I've added support for it and 'location.db' files in my project Wsock-trace: https://github.com/gvanem/wsock-trace
The patched up 'libloc' version: https://github.com/gvanem/wsock-trace/tree/master/src/Geo-IP/IPFire/src
Do you intend to upstream those changes at some point (if that is possible)?
-- --gv