Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static analysis improvements #252

Merged
merged 4 commits into from Aug 2, 2019

Conversation

@pabs3
Copy link
Contributor

commented Aug 2, 2019

A few code improvements suggested by cppcheck, scan-build static analysis tools.

pabs3 added 4 commits Aug 2, 2019
Reduce scope of url and postdata variables
Suggested-by: cppcheck -j1 --quiet --enable=all .
[libdiscord.c:4812]: (style) The scope of the variable 'url' can be reduced.
[libdiscord.c:4813]: (style) The scope of the variable 'postdata' can be reduced.
Fix a memory leak when sending messages
Suggested-by: scan-build make
libdiscord.c:4997:4: warning: Potential leak of memory pointed to by 'msg'
Drop discord_dump_int64_hashtable_keys function
It is not used Pidgin nor by any other function.

Fixes: commit 338ef5b
Suggested-by: cppcheck -j1 --quiet --enable=all .
[libdiscord.c:479]: (style) The function 'discord_dump_int64_hashtable_keys' is never used.
Rename some loop variables that shadow outer variables
Suggested-by: cppcheck -j1 --quiet --enable=all .
[libdiscord.c:1745] -> [libdiscord.c:1777]: (style) Local variable 'i' shadows outer variable
[libdiscord.c:1745] -> [libdiscord.c:1847]: (style) Local variable 'i' shadows outer variable
[libdiscord.c:5178] -> [libdiscord.c:5238]: (style) Local variable 'i' shadows outer variable

@EionRobb EionRobb merged commit 5222f86 into EionRobb:master Aug 2, 2019

@EionRobb

This comment has been minimized.

Copy link
Owner

commented Aug 2, 2019

That's awesome. Thank you :)

@pabs3

This comment has been minimized.

Copy link
Contributor Author

commented Aug 3, 2019

@EionRobb

This comment has been minimized.

Copy link
Owner

commented Aug 5, 2019

Thanks :)
I believe I've unshadowed them in 48e8287

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.