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

r.statistics: Fix uninitialized variable warning in o_var #4005

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

ShubhamDesai
Copy link
Contributor

This pull request addresses the following warning identified by cppcheck.

Issue:
o_var.c:70:16: error: Uninitialized variable: count [uninitvar]
m_var(tab, count, &vari);

Changes made:
The issue was fixed by initializing the variable count to 0 at the beginning of the o_var function. This ensures that the variable has a defined value before it is used in the calculation.

@github-actions github-actions bot added raster Related to raster data processing C Related code is in C module labels Jul 8, 2024
@ShubhamDesai ShubhamDesai changed the title Fix uninitialized variable issue in o_var.c raster: Fix uninitialized variable issue in o_var.c Jul 8, 2024
Copy link
Member

@echoix echoix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, just a question like this, would it be possible to have multiple, or all, issues that have the exact same reasoning be fixed at once in one PR? (You can limit to a folder (like raster, vector, temporal, or group all of the modules together) if the amount of changes is too big). You can still leave out more complex fixes in a separate PR if you want. I think it would make better use of reviewer's time (as you will still need to wait about the same time to get a first answer, and we still need to read the context each time), but also CI time (2 x 1h using 20 runners), and your time, as not needing to write so many PRs.

Some PRs like this one, and some others are really trivial, and would be better grouped.

So, you have the choice of grouping: per issue, per folder, per your-confidence-level-on-the-fix, per file, etc.

Moreover, you're starting to get the hang of it, so your fixes should start being right on the first try more often ;)

raster/r.statistics/o_var.c Show resolved Hide resolved
raster/r.statistics/o_var.c Show resolved Hide resolved
@marisn marisn merged commit 3e8706d into OSGeo:main Jul 9, 2024
26 of 27 checks passed
@neteler neteler added this to the 8.5.0 milestone Jul 9, 2024
a0x8o pushed a commit to a0x8o/grass that referenced this pull request Jul 23, 2024
Fix uninitialized variable issue in o_var.c

Co-authored-by: Shubham Vasudeo Desai <[email protected]>
@wenzeslaus wenzeslaus changed the title raster: Fix uninitialized variable issue in o_var.c r.statistics: Fix uninitialized variable warning in o_var Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C module raster Related to raster data processing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants