mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-10-23 14:18:17 -04:00
for consistency use memcpy/memset everywhere instead of bcopy/bzero
This commit is contained in:
1 parent
e8f5b936ad
commit
f578043391
8 files changed
+19
-27
No files matched your search
+8
-8
@@ -77,7 +77,7 @@ void get_checksum2(char *buf,int len,char *sum)
|
||||
|
||||
MDbegin(&MD);
|
||||
|
||||
bcopy(buf,buf1,len);
|
||||
memcpy(buf1,buf,len);
|
||||
if (checksum_seed) {
|
||||
SIVAL(buf1,len,checksum_seed);
|
||||
len += 4;
|
||||
@@ -102,7 +102,7 @@ void file_checksum(char *fname,char *sum,OFF_T size)
|
||||
OFF_T len = size;
|
||||
char tmpchunk[CSUM_CHUNK];
|
||||
|
||||
bzero(sum,csum_length);
|
||||
memset(sum,0,csum_length);
|
||||
|
||||
fd = open(fname,O_RDONLY);
|
||||
if (fd == -1) return;
|
||||
@@ -112,12 +112,12 @@ void file_checksum(char *fname,char *sum,OFF_T size)
|
||||
MDbegin(&MD);
|
||||
|
||||
for(i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK) {
|
||||
bcopy(map_ptr(buf,i,CSUM_CHUNK),tmpchunk,CSUM_CHUNK);
|
||||
memcpy(tmpchunk, map_ptr(buf,i,CSUM_CHUNK), CSUM_CHUNK);
|
||||
MDupdate(&MD, tmpchunk, CSUM_CHUNK*8);
|
||||
}
|
||||
|
||||
if (len - i > 0) {
|
||||
bcopy(map_ptr(buf,i,len-i),tmpchunk,len-i);
|
||||
memcpy(tmpchunk, map_ptr(buf,i,len-i), len-i);
|
||||
MDupdate(&MD, tmpchunk, (len-i)*8);
|
||||
}
|
||||
|
||||
@@ -155,27 +155,27 @@ void sum_update(char *p,int len)
|
||||
{
|
||||
int i;
|
||||
if (len + sumresidue < CSUM_CHUNK) {
|
||||
bcopy(p,sumrbuf+sumresidue,len);
|
||||
memcpy(sumrbuf+sumresidue, p, len);
|
||||
sumresidue += len;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sumresidue) {
|
||||
i = MIN(CSUM_CHUNK-sumresidue,len);
|
||||
bcopy(p,sumrbuf+sumresidue,i);
|
||||
memcpy(sumrbuf+sumresidue,p,i);
|
||||
MDupdate(&sumMD, sumrbuf, (i+sumresidue)*8);
|
||||
len -= i;
|
||||
p += i;
|
||||
}
|
||||
|
||||
for(i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK) {
|
||||
bcopy(p+i,sumrbuf,CSUM_CHUNK);
|
||||
memcpy(sumrbuf,p+i,CSUM_CHUNK);
|
||||
MDupdate(&sumMD, sumrbuf, CSUM_CHUNK*8);
|
||||
}
|
||||
|
||||
if (len - i > 0) {
|
||||
sumresidue = len-i;
|
||||
bcopy(p+i,sumrbuf,sumresidue);
|
||||
memcpy(sumrbuf,p+i,sumresidue);
|
||||
} else {
|
||||
sumresidue = 0;
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ echo no)
|
||||
AC_FUNC_MEMCMP
|
||||
AC_FUNC_UTIME_NULL
|
||||
AC_CHECK_FUNCS(mmap munmap waitpid getcwd strdup strerror chown chmod mknod)
|
||||
AC_CHECK_FUNCS(fchmod fstat strchr bcopy bzero readlink link utime utimes)
|
||||
AC_CHECK_FUNCS(fchmod fstat strchr readlink link utime utimes)
|
||||
AC_CHECK_FUNCS(memmove getopt_long lchown setlinebuf vsnprintf setsid glob strpbrk)
|
||||
|
||||
echo $ac_n "checking for working fnmatch... $ac_c"
|
||||
|
||||
@@ -211,7 +211,7 @@ static void receive_file_entry(struct file_struct **fptr,
|
||||
|
||||
file = (struct file_struct *)malloc(sizeof(*file));
|
||||
if (!file) out_of_memory("receive_file_entry");
|
||||
bzero((char *)file,sizeof(*file));
|
||||
memset((char *)file, 0, sizeof(*file));
|
||||
(*fptr) = file;
|
||||
|
||||
if (l2 >= MAXPATHLEN-l1) overflow("receive_file_entry");
|
||||
@@ -325,7 +325,7 @@ static struct file_struct *make_file(char *fname)
|
||||
clean_fname(cleaned_name);
|
||||
fname = cleaned_name;
|
||||
|
||||
bzero(sum,SUM_LENGTH);
|
||||
memset(sum,0,SUM_LENGTH);
|
||||
|
||||
if (link_stat(fname,&st) != 0) {
|
||||
io_error = 1;
|
||||
@@ -352,7 +352,7 @@ static struct file_struct *make_file(char *fname)
|
||||
|
||||
file = (struct file_struct *)malloc(sizeof(*file));
|
||||
if (!file) out_of_memory("make_file");
|
||||
bzero((char *)file,sizeof(*file));
|
||||
memset((char *)file,0,sizeof(*file));
|
||||
|
||||
if ((p = strrchr(fname,'/'))) {
|
||||
static char *lastdir;
|
||||
@@ -794,7 +794,7 @@ static void free_file(struct file_struct *file)
|
||||
if (file->basename) free(file->basename);
|
||||
if (file->link) free(file->link);
|
||||
if (file->sum) free(file->sum);
|
||||
bzero((char *)file, sizeof(*file));
|
||||
memset((char *)file, 0, sizeof(*file));
|
||||
}
|
||||
|
||||
|
||||
@@ -808,9 +808,9 @@ void flist_free(struct file_list *flist)
|
||||
free_file(flist->files[i]);
|
||||
free(flist->files[i]);
|
||||
}
|
||||
bzero((char *)flist->files, sizeof(flist->files[0])*flist->count);
|
||||
memset((char *)flist->files, 0, sizeof(flist->files[0])*flist->count);
|
||||
free(flist->files);
|
||||
bzero((char *)flist, sizeof(*flist));
|
||||
memset((char *)flist, 0, sizeof(*flist));
|
||||
free(flist);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ void init_hard_links(struct file_list *flist)
|
||||
out_of_memory("init_hard_links");
|
||||
|
||||
for (i = 0; i < flist->count; i++)
|
||||
bcopy(flist->files[i], &hlink_list[i], sizeof(hlink_list[0]));
|
||||
memcpy(&hlink_list[i], flist->files[i], sizeof(hlink_list[0]));
|
||||
|
||||
qsort(hlink_list,flist->count,
|
||||
sizeof(hlink_list[0]),
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ pid_t waitpid(pid_t pid, int *statptr, int options)
|
||||
#ifndef HAVE_MEMMOVE
|
||||
void *memmove(void *dest, const void *src, size_t n)
|
||||
{
|
||||
bcopy(src, dest, n);
|
||||
memcpy(dest, src, n);
|
||||
return dest;
|
||||
}
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -329,7 +329,7 @@ initialise a service to the defaults
|
||||
***************************************************************************/
|
||||
static void init_service(service *pservice)
|
||||
{
|
||||
bzero((char *)pservice,sizeof(service));
|
||||
memset((char *)pservice,0,sizeof(service));
|
||||
copy_service(pservice,&sDefault);
|
||||
}
|
||||
|
||||
|
||||
@@ -373,14 +373,6 @@ extern char *sys_errlist[];
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_BCOPY
|
||||
#define bcopy(src,dest,n) memcpy(dest,src,n)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_BZERO
|
||||
#define bzero(buf,n) memset(buf,0,n)
|
||||
#endif
|
||||
|
||||
#define SUPPORT_LINKS HAVE_READLINK
|
||||
#define SUPPORT_HARD_LINKS HAVE_LINK
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ static int open_socket_in(int type, int port)
|
||||
return -1;
|
||||
}
|
||||
|
||||
bzero((char *)&sock,sizeof(sock));
|
||||
memset((char *)&sock,0,sizeof(sock));
|
||||
memcpy((char *)&sock.sin_addr,(char *)hp->h_addr, hp->h_length);
|
||||
sock.sin_port = htons(port);
|
||||
sock.sin_family = hp->h_addrtype;
|
||||
|
||||
Reference in new issue
Block a user