mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-09 13:12:05 -04:00
Instead of choosing between memcpy and memmove at run time, call
memmove unconditionally since any reasonable implementation of memmove will perform such a choice internally, and also doing it in the caller duplicates the effort.
This commit is contained in:
parent
b1a7fea53c
commit
60dcbecf04
1 changed files with 4 additions and 18 deletions
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: name.c,v 1.126 2001/06/21 01:30:22 gson Exp $ */
|
||||
/* $Id: name.c,v 1.127 2001/06/28 21:34:11 gson Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -2854,13 +2854,7 @@ dns_name_split(dns_name_t *name,
|
|||
len = bitbytes;
|
||||
|
||||
if (mod == 0) {
|
||||
if ((void *)(name->ndata) ==
|
||||
prefix->buffer->base &&
|
||||
len > (unsigned int)(src - dst))
|
||||
memmove(dst, src, len);
|
||||
else
|
||||
memcpy(dst, src, len);
|
||||
|
||||
memmove(dst, src, len);
|
||||
} else {
|
||||
/*
|
||||
* p is adjusted to point to the last byte of
|
||||
|
|
@ -2974,16 +2968,8 @@ dns_name_split(dns_name_t *name,
|
|||
} else
|
||||
len = suffix->length - 2;
|
||||
|
||||
/*
|
||||
* XXX DCL better way to decide memcpy vs memmove?
|
||||
*/
|
||||
if (len > 0) {
|
||||
if ((dst <= src && dst + len > src) ||
|
||||
(src <= dst && src + len > dst))
|
||||
memmove(dst, src, len);
|
||||
else
|
||||
memcpy(dst, src, len);
|
||||
}
|
||||
if (len > 0)
|
||||
memmove(dst, src, len);
|
||||
|
||||
suffix->buffer->used = suffix->length;
|
||||
suffix->ndata = suffix->buffer->base;
|
||||
|
|
|
|||
Loading…
Reference in a new issue