AdaCore / AdaCore/spawn

Use De Morgan to simplify code

Open
#28 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ada
Stars
17
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Hi Spawn developers,

Why not use De Morgan to simplify
https://github.com/AdaCore/spawn/blob/9122c2970d6332f3d5db2042e19fdd4abffd186a/source/spawn/spawn-processes-windows.adb#L691-L692
into

        if (Self.Status /= Not_Running)
          or else (dwErrorCode /= Windows_API.ERROR_OPERATION_ABORTED)

Problem detected and solved by Rejuvenation-Ada crate
vote for Rejuvenation-Ada as The 2022 Ada Crate Of The Year

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open source/spawn/spawn-processes-windows.adb at lines 691-692 and inspect the existing condition in context. Replace it with the De Morgan form shown in the issue, preserving the existing status and Windows error checks. Done means the condition is simplified without changing its behavior.

Written by the indexing model from the issue text.

Assessment

Domain
operating-systems
Issue type
Refactor
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.