Thats why its a stupid warning (or at least stupid to enable by default) because many system interfaces use int as a counter (like argc) and everybody knows they are never negative
To be fair, it's not the actual argc
, it's a random value popped off the Lua stack, it could be anything and the code only guards against value 0
, not < 0
.
Also, unrelated, that line looks wrong because of the order of operations and missing parenthesis, I believe it will allocate room for the needed pointers plus one byte. Presumably it's meant to be sizeof(gchar*) * (argc+1)
to allocate storage for the number of pointers plus one extra pointer for the sentinel NULL
as is customary with argv
/GStrv
.
To fix the warning and bug, it could probably be changed to:
argv = g_malloc0_n(argc+1, sizeof(gchar*));
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.