STYLE: Replace Allocate(); FillBuffer(0) with AllocateInitialized()#4494
Merged
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:masterfrom Mar 6, 2024
Conversation
Replaced lines of code of the form
image>Allocate();
image>FillBuffer(zero);
With `image->AllocateInitialized();`.
Cases found by the regular expression `^(.+->)Allocate.+;\r\n\1FillBuffer`.
Follow-up to pull request InsightSoftwareConsortium#4479
commit 47fe345
"ENH: Add `AllocateInitialized()` to ImageBase"
dzenanz
approved these changes
Mar 5, 2024
hjmjohnson
approved these changes
Mar 6, 2024
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this pull request
Oct 30, 2025
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\(\);`
Follow-up to pull request InsightSoftwareConsortium#4494
commit cd49925
"STYLE: Replace `Allocate(); FillBuffer(0)` with `AllocateInitialized()`"
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this pull request
Oct 31, 2025
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()`"
dzenanz
pushed a commit
that referenced
this pull request
Oct 31, 2025
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 #4494
commit cd49925
"STYLE: Replace `Allocate(); FillBuffer(0)` with `AllocateInitialized()`"
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this pull request
Oct 31, 2025
Using Notepad++, Replace in Files, doing: Find what: `^( .+)Allocate\(\);[\r\n]+\1FillBuffer\(0\);` Replace with: `$1AllocateInitialized\(\);` Again, another follow-up to pull request InsightSoftwareConsortium#4494 commit cd49925 "STYLE: Replace `Allocate(); FillBuffer(0)` with `AllocateInitialized()`"
hjmjohnson
pushed a commit
to hjmjohnson/ITK
that referenced
this pull request
Nov 1, 2025
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()`"
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this pull request
Nov 2, 2025
Found by searching for `FillBuffer(0)` in *.py files. Follow-up to pull request InsightSoftwareConsortium#4494 commit cd49925 "STYLE: Replace `Allocate(); FillBuffer(0)` with `AllocateInitialized()`"
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this pull request
Nov 2, 2025
Using Notepad++, Replace in Files, doing: Find what: `^( .+)Allocate\(\);[\r\n]+\1FillBuffer\(0\);` Find what: `^( .+)Allocate\(\);[\r\n]+\1FillBuffer\(0.0\); Replace with: `$1AllocateInitialized\(\);` Again, another follow-up to pull request InsightSoftwareConsortium#4494 commit cd49925 "STYLE: Replace `Allocate(); FillBuffer(0)` with `AllocateInitialized()`"
hjmjohnson
pushed a commit
that referenced
this pull request
Nov 2, 2025
Using Notepad++, Replace in Files, doing: Find what: `^( .+)Allocate\(\);[\r\n]+\1FillBuffer\(0\);` Find what: `^( .+)Allocate\(\);[\r\n]+\1FillBuffer\(0.0\); Replace with: `$1AllocateInitialized\(\);` Again, another follow-up to pull request #4494 commit cd49925 "STYLE: Replace `Allocate(); FillBuffer(0)` with `AllocateInitialized()`"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaced lines of code of the form
With
image->AllocateInitialized();.Cases found by the regular expression
^(.+->)Allocate.+;\r\n\1FillBuffer.Follow-up to pull request #4479 commit 47fe345
"ENH: Add
AllocateInitialized()to ImageBase"