remove consts from tsk_json_struct_metadata_get_blob (closes #3425)#3427
remove consts from tsk_json_struct_metadata_get_blob (closes #3425)#3427benjeffery merged 1 commit intotskit-dev:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3427 +/- ##
=======================================
Coverage 91.92% 91.92%
=======================================
Files 37 37
Lines 32153 32153
Branches 5143 5143
=======================================
Hits 29556 29556
Misses 2264 2264
Partials 333 333
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
I'm not sure what this means: "github-merge-queue bot removed this pull request from the merge queue due to no response for status checks". But it looks like it passed all checks, and the PR looks good to me. Can this merge be bumped somehow? |
|
I suspect maaaaybe github's automated stuff dropped the ball? Trying again; will manually merge if not. |
The auto-merge seems to have failed again. Maybe there's a time limit for all the checks to complete, and if they don't finish within that time limit the auto-merge gets cancelled? In which case that time limit needs to get extended somehow/somewhere, otherwise the auto-merge is seeming pretty useless. :-> Anyhow, manual merge for now, I guess? |
|
Merge queue fixed in both #3436 and in repo-wide checks config. |
As discussed in #3425, it is maybe helpful to remove the
constfrom some of the arguments totsk_json_struct_metadata_get_blob.My superficial understanding of the issue is as follows: suppose you have a function that accepts a pointer, say
*blob, and doesn't modify the stuff that pointer points at. Then it's fine to define your function to acceptconst foo *blobbut then pass it in a non-constfoo *blobfrom somewhere else, sinceconstis supposed to mean "we don't change this here" not "we don't change this anywhere". However if it takes a pointer-to-a-pointer, sayconst foo **blobthen there are ways that you'd actually be able to modify the contents being ultimately pointed at without, like, noticing. So it is not cool to pass infoo **blob.So, I agree - seems like we should indeed remove the
const.According to this page the "most common solution" is to declare it like
const foo* const *blob; however, I think this means you can't change the pointer*blobeither and we do indeed need to do that in this function. And I tried it and it doesn't seem to work.So here I've removed the
constfrom**blob. This meant I also needed to removeconstfrom**jsonand*metadata, since these are all pointing at the same chunk of memory.