Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix C lint errors (issue #6475) #6489

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

sahilk45
Copy link
Contributor

@sahilk45 sahilk45 commented Apr 1, 2025

Resolves #6475

Description

What is the purpose of this pull request?

This PR addresses C linting issues in benchmark.length.c by replacing variable-length arrays (VLAs) with dynamically allocated memory.

  • Replaced VLAs (double x[len];) with dynamic memory allocation (malloc) for better compatibility and avoiding potential stack overflows.
  • Added memory allocation failure checks to prevent undefined behavior.
  • Ensured proper memory deallocation (free) at the end of execution.
  • Initialized all variables at declaration to prevent uninitialized variable warnings.

Related Issues

Does this pull request have any related issues?

This pull request:

Questions

Any questions for reviewers of this pull request?

Can we prefer using VLAs (which are valid in C99) ?

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Apr 1, 2025
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Apr 1, 2025

Coverage Report

Package Statements Branches Functions Lines
strided/base/dmap $\color{green}206/206$
$\color{green}+100.00\%$
$\color{green}9/9$
$\color{green}+100.00\%$
$\color{green}2/2$
$\color{green}+100.00\%$
$\color{green}206/206$
$\color{green}+100.00\%$

The above coverage report was generated for the changes in this PR.

@kgryte kgryte added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Apr 1, 2025
following the same codebase 

Signed-off-by: SAHIL KUMAR <[email protected]>
@sahilk45 sahilk45 requested a review from kgryte April 1, 2025 12:25
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Apr 1, 2025
@sahilk45
Copy link
Contributor Author

sahilk45 commented Apr 2, 2025

@kgryte Thank you for suggestion. PLease review it again I made the asked changes. Let me know if anything else is still requires.
regards,
SAHIL KUMAR

@sahilk45 sahilk45 changed the title Clint errorchore: fix C lint errors #6475 Clint: fix C lint errors #6475 Apr 2, 2025
@sahilk45 sahilk45 changed the title Clint: fix C lint errors #6475 Chore: fix C lint errors #6475 Apr 2, 2025
@sahilk45 sahilk45 changed the title Chore: fix C lint errors #6475 chore: fix C lint errors (issue #6475) Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Changes Pull request which needs changes before being merged. Needs Review A pull request which needs code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix C lint errors
3 participants