Foundation Classes - Modernize NCollection_SparseArrayBase memory handling and style#804
Merged
dpasukhi merged 1 commit intoOpen-Cascade-SAS:IRfrom Nov 4, 2025
Merged
Conversation
…dling and style Replace raw malloc/calloc/free with Standard::AllocateOptimal/Standard::Free and memset, use nullptr instead of 0, add null checks/braces, remove custom sswap in favor of std::swap, and update Iterator ctor default and deleted copy/assignment declarations.
There was a problem hiding this comment.
Pull Request Overview
This PR modernizes the NCollection_SparseArrayBase memory handling and coding style to align with modern C++ practices. The changes replace deprecated C-style memory management with OCCT's standard allocation functions, improve null safety, and adopt contemporary C++ idioms.
Key changes:
- Replace malloc/calloc/free with Standard::AllocateOptimal/Standard::Free for OCCT-consistent memory management
- Modernize constructor declarations and use nullptr instead of 0 for null pointers
- Replace custom swap implementation with std::swap and add noexcept specifications
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| NCollection_SparseArrayBase.hxx | Updates constructor default parameter to nullptr, modernizes copy/assignment operator declarations with delete, and adds noexcept to exchange method |
| NCollection_SparseArrayBase.cxx | Replaces malloc/calloc/free with Standard memory functions, adds null checks and braces, removes custom sswap in favor of std::swap, and includes proper headers |
| NCollection_SparseArray.hxx | Adds self-assignment check, noexcept specifications for constructors and Exchange method |
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.
Replace raw malloc/calloc/free with Standard::AllocateOptimal/Standard::Free and memset
use nullptr instead of 0, add null checks/braces, remove custom sswap in favor of std::swap, and update Iterator ctor default and deleted copy/assignment declarations.