Embed Notice
HTML Code
Corresponding Notice
- Embed this notice
zirias (on snac) (zirias@snac.bsd.cafe)'s status on Friday, 08-Nov-2024 18:36:42 JSTzirias (on snac) Ok, I can't immediately spot the issue with the parts of the code seen so far. If I had to debug this, I'd fire some tooling on it (e.g. the compiler's "address sanitizer" and similer, valgrind, ...) first.
But then, this also looks like some code in desperate need of refactoring. "Three stars" should almost always raise an eyebrow: https://wiki.c2.com/?ThreeStarProgrammer ... and the MAX_INPUTS constant looks weird, if it's actually the maximum index, making it one less than the number of inputs 🧐
I'd also suggest to use expressions instead of type names with the sizeof operator, making the code more robust to change, e.g. sizeof(char **) → sizeof *sub[slot].udp_volts in the above line of code, but that's a stylistic thing...