[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: memmove instead of memcpy
From: |
David Chisnall |
Subject: |
Re: memmove instead of memcpy |
Date: |
Sat, 12 Feb 2011 20:35:22 +0000 |
On 12 Feb 2011, at 20:22, Philippe Roussel wrote:
> Hi,
>
> Are these kind of patches considered useful ?
Yes, definitely.
> Documentation says memmove should be used when the memory areas overlap
> and valgrind warns about it.
The patch looks right, but I'll let Richard check it before committing...
David
> Philippe
>
>
> Index: base/Source/NSPointerArray.m
> ===================================================================
> --- base/Source/NSPointerArray.m (révision 32115)
> +++ base/Source/NSPointerArray.m (copie de travail)
> @@ -281,7 +281,7 @@
> }
> if (i < _count - 1)
> {
> - memcpy(_contents + j, _contents + i + 1,
> + memmove(_contents + j, _contents + i + 1,
> (_count - i) * sizeof(void*));
> }
> _count = i = j;
>
>
>
> _______________________________________________
> Gnustep-dev mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/gnustep-dev
--
This email complies with ISO 3103