Skip to content

Conversation

ZoomRmc
Copy link
Contributor

@ZoomRmc ZoomRmc commented Sep 19, 2025

  • Removed redundant len and reserved sets already performed by prior rawNewStringNoInit calls.
  • Reuse appendChar
  • Removed never used newOwnedString
  • Added internal toOwnedCopy
  • Documents differences in impls of internal procs used for system.string.setLen:
    • strs_v2.setLengthStrV2:
      • does not set the terminating zero byte when new length is 0
      • does not handle negative new length
    • sysstr.setLengthStr:
      • sets the terminating zero byte when new length is 0
      • bounds negative new length to 0

- Removed redundant `len` and `reserved` sets already
     performed by prior `rawNewStringNoInit` calls.
- Reuse `appendChar`
- Removed never used `newOwnedString`
- Added internal `toOwnedCopy`
- Documents differences in impls of internal procs used for
  `system.string.setLen`:
  + `strs_v2.setLengthStrV2`:
    - does not set the terminating zero byte when new length is 0
    - does not handle negative new length
  + `sysstr.setLengthStr`:
    - sets the terminating zero byte when new length is 0
    - bounds negative new length to 0
ZoomRmc added a commit to ZoomRmc/Nim that referenced this pull request Sep 21, 2025
Continuation of nim-lang#25180. This one refactors the sequence routines.

Preparation for extending with new routines.

Mostly removes repeating code to simplify debugging.

Removes:
 - `incrSeq` and `incrSeqV2` superseded by `incrSeqV3`,
 - `setLengthSeq` superseded by `setLengthSeqV2`

Note comment on line 338, acknowledging that implementation of
`setLenUninit` from nim-lang#25022 does zero the new memory in this branch,
having been copied from `setLengthSeqV2`. This PR does not fix this.
ZoomRmc added a commit to ZoomRmc/Nim that referenced this pull request Sep 21, 2025
Continuation of nim-lang#25180. This one refactors the sequence routines.

Preparation for extending with new routines.

Mostly removes repeating code to simplify debugging.

Removes:
 - `incrSeqV2` superseded by `incrSeqV3`,
 - `setLengthSeq` superseded by `setLengthSeqV2`

Note comment on line 338, acknowledging that implementation of
`setLenUninit` from nim-lang#25022 does zero the new memory in this branch,
having been copied from `setLengthSeqV2`. This PR does not fix this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant