This repository has been archived by the owner. It is now read-only.

Docs: Not memcpy, but memmove #1520

Closed
thejh opened this Issue Aug 13, 2011 · 3 comments

Comments

Projects
None yet
2 participants

thejh commented Aug 13, 2011

http://nodejs.org/docs/v0.5.3/api/buffers.html#buffer.copy says:

Does a memcpy() between buffers.

But it's a memmove.

koichik commented Aug 14, 2011

Thanks for the report, but it explains functionality, not accurate implementation detail.

@koichik koichik closed this Aug 14, 2011

thejh commented Aug 14, 2011

That is relevant to the functionality! If I have a buffer

<Buffer 68 65 6c 6c 6f 20 00 77 6f 72 6c 64>

and want to get rid of that nullbyte, moving the stuff inside the buffer wouldn't be safe if I used a memcpy. I would need to allocate a second buffer. However, because it's a memmove, I can do that.

koichik commented Aug 14, 2011

I see, I will fix soon.

@koichik koichik reopened this Aug 14, 2011

@koichik koichik closed this in 4d186f2 Aug 14, 2011

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.