STYLE: Replace Allocate(); FillBuffer({}) with AllocateInitialized()#5582
Conversation
Replaced lines of code of the form
image->Allocate();
image->FillBuffer(PixelType{});
With `image->AllocateInitialized();`.
Using Notepad++, Replace in Files, doing:
Find what: `^( .+->)Allocate\(\);[\r\n]+\1FillBuffer\(.*{}\);`
Replace with: `$1AllocateInitialized\(\);`
Manually replaced a few more cases, found by the regular expression
`FillBuffer\(.*\{\}\);`
Follow-up to pull request InsightSoftwareConsortium#4494
commit cd49925
"STYLE: Replace `Allocate(); FillBuffer(0)` with `AllocateInitialized()`"
52b4159 to
b37c81b
Compare
hjmjohnson
left a comment
There was a problem hiding this comment.
Very nice. Approved when CI passes.
|
Are there any instances of |
Do you mean, specifically when |
|
Yes. |
|
I think there are still a few unnecessary |
@dzenanz No instances found, using Notepad++ Find in Files, with the following regular expression: |
|
I didn't, I was just wondering if there are any. |
Replaced lines of code of the form
With
image->AllocateInitialized();.Using Notepad++, Replace in Files, doing:
Find what:
(.+->)Allocate\(\);[\r\n]+\1FillBuffer\(.*{}\);Replace with:
$1AllocateInitialized\(\);Allocate(); FillBuffer(0)withAllocateInitialized()#4494