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

v.vol.rst: Initialize structure contents before passing it around #4282

Merged
merged 2 commits into from
Sep 10, 2024

Conversation

ymdatta
Copy link
Contributor

@ymdatta ymdatta commented Sep 5, 2024

skip_point structure is not initialized when declared.

  1. Only when cv is true, skip_point contents are filled and the structure is used.
  2. cppcheck raised the issue when cv is false. Technically, we don't need skip_point in such cases and not initializing it won't affect the execution. Nevertheless, it's a good practice to initialize structure contents at the time of declaration.

This was found using cppcheck tool.

Additional information:

  1. Machine used: Virtual Machine running Ubuntu 22.04.4 LTS.
  2. Reproduction rate: 100%, reproducible every time.
  3. Output from cppcheck prior to fix
image

After the fix:

image

`skip_point` structure is not initialized when declared. This was
found using cppcheck tool.

Only when `cv` is true, `skip_point` contents are filled and the
structure is used. cppcheck raised the issue when 'cv' is false.
Technically, we don't need skip_point in such cases and not
initializing it won't affect the execution. Nevertheless, it's a
good practice to initialize structure contents at the time of
declaration.

Signed-off-by: Mohan Yelugoti <[email protected]>
@github-actions github-actions bot added vector Related to vector data processing C Related code is in C module labels Sep 5, 2024
vector/v.vol.rst/user2.c Outdated Show resolved Hide resolved
@neteler neteler added this to the 8.5.0 milestone Sep 10, 2024
@echoix echoix merged commit a85c7b0 into OSGeo:main Sep 10, 2024
26 checks passed
Mahesh1998 pushed a commit to Mahesh1998/grass that referenced this pull request Sep 19, 2024
…Geo#4282)

* v.vol.rst: Initialize structure contents before passing it around

`skip_point` structure is not initialized when declared. This was
found using cppcheck tool.

Only when `cv` is true, `skip_point` contents are filled and the
structure is used. cppcheck raised the issue when 'cv' is false.
Technically, we don't need skip_point in such cases and not
initializing it won't affect the execution. Nevertheless, it's a
good practice to initialize structure contents at the time of
declaration.

Signed-off-by: Mohan Yelugoti <[email protected]>

* Use correct literal for double type

Co-authored-by: Nicklas Larsson <[email protected]>

---------

Signed-off-by: Mohan Yelugoti <[email protected]>
Co-authored-by: Nicklas Larsson <[email protected]>
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 vector Related to vector data processing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants