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

Converted all memset() deletions to conventional clearing methods #3363

Closed
wants to merge 2 commits into from

Conversation

delta1513
Copy link

Fixes #3245

Description of the Change
The memset() function is used to delete certain structs by overwriting them with zeroes, this can be unsafe and causes the compiler to complain with a warning.

This was solved by replacing memsets with empty struct initialisers where possible. There were some instances where this was being overwritten, and in this case, I had to create clear() methods in each of the structs that had these memsets.

Notes:

  • I took the liberty to do some garbage collection in one of the clear() functions, namely APP_VERSION::clear() in gui_rpc_client_ops.cpp. Just a heads-up in-case this is bad, but I saw only good in doing this considering the previous implementation simply made the ptr = 0.
  • It looks like my editor may have messed with some of the spaces and tabs.
  • This is my first PR so feedback is appreciated!

Alternate Designs
N/A

Release Notes
Removed all object deletions using memset() and created conventional clearing functions

@codecov
Copy link

codecov bot commented Nov 4, 2019

Codecov Report

Merging #3363 into master will not change coverage.
The diff coverage is 0%.

@@          Coverage Diff           @@
##           master   #3363   +/-   ##
======================================
  Coverage    9.27%   9.27%           
======================================
  Files          36      36           
  Lines        5992    5992           
======================================
  Hits          556     556           
  Misses       5436    5436
Impacted Files Coverage Δ
lib/coproc.h 0% <0%> (ø) ⬆️

@davidpanderson
Copy link
Contributor

I'm going to do this a different way, as described here:
https://stackoverflow.com/questions/6891720/initialize-reset-struct-to-zero-null

@AenBleidd
Copy link
Member

Closing in favor of #3364

@AenBleidd AenBleidd closed this Nov 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants