Skip to content

Foundation Classes - Modernize NCollection_SparseArrayBase memory handling and style#804

Merged
dpasukhi merged 1 commit intoOpen-Cascade-SAS:IRfrom
dpasukhi:sparse_array_update
Nov 4, 2025
Merged

Foundation Classes - Modernize NCollection_SparseArrayBase memory handling and style#804
dpasukhi merged 1 commit intoOpen-Cascade-SAS:IRfrom
dpasukhi:sparse_array_update

Conversation

@dpasukhi
Copy link
Copy Markdown
Member

@dpasukhi dpasukhi commented Nov 3, 2025

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.

…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.
@dpasukhi dpasukhi added this to the Release 8.0 milestone Nov 3, 2025
@dpasukhi dpasukhi requested a review from Copilot November 3, 2025 23:15
@dpasukhi dpasukhi self-assigned this Nov 3, 2025
@dpasukhi dpasukhi added the 2. Enhancement New feature or request label Nov 3, 2025
@dpasukhi dpasukhi added 1. Foundation Classes Containers, system calls wrappers, smart pointers and other low level of OCCT code 1. Coding Coding rules, trivial changes and misprints labels Nov 3, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@dpasukhi dpasukhi marked this pull request as ready for review November 4, 2025 10:55
@dpasukhi dpasukhi merged commit f923370 into Open-Cascade-SAS:IR Nov 4, 2025
23 checks passed
@dpasukhi dpasukhi deleted the sparse_array_update branch November 4, 2025 10:55
@github-project-automation github-project-automation bot moved this from Todo to Done in Maintenance Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1. Coding Coding rules, trivial changes and misprints 1. Foundation Classes Containers, system calls wrappers, smart pointers and other low level of OCCT code 2. Enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants