Skip to content

STYLE: Replace Allocate(); FillBuffer(0) with AllocateInitialized()#4494

Merged
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:masterfrom
N-Dekker:Replace-Allocate-FillBuffer-with-AllocateInitialized
Mar 6, 2024
Merged

STYLE: Replace Allocate(); FillBuffer(0) with AllocateInitialized()#4494
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:masterfrom
N-Dekker:Replace-Allocate-FillBuffer-with-AllocateInitialized

Conversation

@N-Dekker
Copy link
Contributor

@N-Dekker N-Dekker commented Mar 5, 2024

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 #4479 commit 47fe345
"ENH: Add AllocateInitialized() to ImageBase"

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"
@github-actions github-actions bot added area:Filtering Issues affecting the Filtering module area:Registration Issues affecting the Registration module area:Segmentation Issues affecting the Segmentation module type:Style Style changes: no logic impact (indentation, comments, naming) labels Mar 5, 2024
@N-Dekker N-Dekker marked this pull request as ready for review March 5, 2024 17:54
@hjmjohnson hjmjohnson merged commit cd49925 into InsightSoftwareConsortium:master Mar 6, 2024
@N-Dekker N-Dekker deleted the Replace-Allocate-FillBuffer-with-AllocateInitialized branch March 13, 2024 01:46
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
Found by searching for `FillBuffer(0)` in *.py files.

Follow-up to pull request #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()`"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Filtering Issues affecting the Filtering module area:Registration Issues affecting the Registration module area:Segmentation Issues affecting the Segmentation module type:Style Style changes: no logic impact (indentation, comments, naming)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants