summaryrefslogtreecommitdiff
path: root/fileio.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2004-05-11 19:46:56 +0000
committerWayne Davison <wayned@samba.org>2004-05-11 19:46:56 +0000
commitbf2b7ddfc56b69808748d15aea7fd04d5b720b10 (patch)
tree32cfdc64a022d38f89b00911fc7bcdc2e6c778ed /fileio.c
parenteb0cbdaa90087abb4f17bd86cee359a8fe5cad3d (diff)
downloadrsync-bf2b7ddfc56b69808748d15aea7fd04d5b720b10.tar.gz
rsync-bf2b7ddfc56b69808748d15aea7fd04d5b720b10.tar.bz2
rsync-bf2b7ddfc56b69808748d15aea7fd04d5b720b10.zip
Use memset() to initialize a new map_struct.
Diffstat (limited to 'fileio.c')
-rw-r--r--fileio.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/fileio.c b/fileio.c
index 925e74b6..5614ed93 100644
--- a/fileio.c
+++ b/fileio.c
@@ -136,7 +136,6 @@ int write_file(int f,char *buf,size_t len)
}
-
/* this provides functionality somewhat similar to mmap() but using
read(). It gives sliding window access to a file. mmap() is not
used because of the possibility of another program (such as a
@@ -144,17 +143,13 @@ int write_file(int f,char *buf,size_t len)
struct map_struct *map_file(int fd,OFF_T len)
{
struct map_struct *map;
- map = new(struct map_struct);
- if (!map) out_of_memory("map_file");
+ if (!(map = new(struct map_struct)))
+ out_of_memory("map_file");
+
+ memset(map, 0, sizeof map[0]);
map->fd = fd;
map->file_size = len;
- map->p = NULL;
- map->p_size = 0;
- map->p_offset = 0;
- map->p_fd_offset = 0;
- map->p_len = 0;
- map->status = 0;
return map;
}
@@ -259,7 +254,7 @@ int unmap_file(struct map_struct *map)
map->p = NULL;
}
ret = map->status;
- memset(map, 0, sizeof(*map));
+ memset(map, 0, sizeof map[0]);
free(map);
return ret;