Skip to content

Use memmove instead of copy_mem_* and user_bcopy - #183

Merged
xiaoyeli merged 1 commit into
xiaoyeli:masterfrom
gruenich:feature/replace-copy-by-memmove
Oct 21, 2026
Merged

xiaoyeli merged 1 commit into
xiaoyeli:masterfrom
gruenich:feature/replace-copy-by-memmove

Conversation

@gruenich

Copy link
Copy Markdown
Contributor

Replace the element-wise copy helpers in [sdcz]memory.c by memmove. The source and destination can overlap when the user-supplied work array is reorganized, which memmove handles, and the byte count is passed as size_t instead of int.

The helper functions themselves are kept for now. I can provide a patch removing them.

Replace the element-wise copy helpers in [sdcz]memory.c by memmove.
The source and destination can overlap when the user-supplied work
array is reorganized, which memmove handles, and the byte count is
passed as size_t instead of int.
@gruenich
gruenich force-pushed the feature/replace-copy-by-memmove branch from 27cd19d to b61863c Compare October 20, 2026 19:02
@xiaoyeli

Copy link
Copy Markdown
Owner

I just fixed a bug in this commit: 53b23ed

Can you re-submit your PR based on my new commit? Thanks!

@gruenich

Copy link
Copy Markdown
Contributor Author

Thanks for the hint. I already rebased the commit.

What do you think, should we remove the helper functions now?

@xiaoyeli
xiaoyeli merged commit 7fd9b80 into xiaoyeli:master Oct 21, 2026
5 checks passed
@xiaoyeli

Copy link
Copy Markdown
Owner

I merged this. But, what do you mean by helper functions?

@gruenich
gruenich deleted the feature/replace-copy-by-memmove branch October 21, 2026 19:07
@gruenich

Copy link
Copy Markdown
Contributor Author

The functions that got replaced and are no longer used like copy_mem_int, copy_mem_singlecomplex, or user_bcopy.

@xiaoyeli

Copy link
Copy Markdown
Owner

We can keep them for some while. We will see the users experiences. The concern is memmove may not yet be supported by all compilers.

Since there are quite a few bug fixes lately, I'll put up a release later today.

@gruenich

Copy link
Copy Markdown
Contributor Author

memmove is part of C89 and should be in every string.h for decades. Our helper functions are not part of the interface, they are not part of a header. I marked them deprecated by a comment, see #186 .

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.

2 participants