summaryrefslogtreecommitdiff
path: root/src/libudev
diff options
context:
space:
mode:
authorGreg KH <gregkh@linuxfoundation.org>2014-02-02 07:15:23 -0500
committerAnthony G. Basile <blueness@gentoo.org>2014-02-02 07:15:23 -0500
commit8fe035158681d0324ff2be99a67bc0434da6faad (patch)
treec9a82a131e2597a62ed392355e39dfc7a888da9d /src/libudev
parent7eefa0ad0db267d99448fcddff2aebb4ebc33f6f (diff)
use memzero(foo, length); for all memset(foo, 0, length); calls
In trying to track down a stupid linker bug, I noticed a bunch of memset() calls that should be using memzero() to make it more "obvious" that the options are correct (i.e. 0 is not the length, but the data to set). So fix up all current calls to memset(foo, 0, length) to memzero(foo, length). Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/libudev')
-rw-r--r--src/libudev/hashmap.c2
-rw-r--r--src/libudev/libudev-device.c2
-rw-r--r--src/libudev/libudev-list.c2
-rw-r--r--src/libudev/libudev-monitor.c10
4 files changed, 8 insertions, 8 deletions
diff --git a/src/libudev/hashmap.c b/src/libudev/hashmap.c
index 23e42f7b34..b92c83202e 100644
--- a/src/libudev/hashmap.c
+++ b/src/libudev/hashmap.c
@@ -168,7 +168,7 @@ Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func) {
if (!h)
return NULL;
- memset(h, 0, size);
+ memzero(h, size);
} else {
h = malloc0(size);
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index 06fadf6341..38144e3fbe 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -810,7 +810,7 @@ _public_ struct udev_device *udev_device_new_from_device_id(struct udev *udev, c
sk = socket(PF_INET, SOCK_DGRAM, 0);
if (sk < 0)
return NULL;
- memset(&ifr, 0x00, sizeof(struct ifreq));
+ memzero(&ifr, sizeof(struct ifreq));
ifr.ifr_ifindex = ifindex;
if (ioctl(sk, SIOCGIFNAME, &ifr) != 0) {
close(sk);
diff --git a/src/libudev/libudev-list.c b/src/libudev/libudev-list.c
index 1cf53b074f..c6e5a61fe9 100644
--- a/src/libudev/libudev-list.c
+++ b/src/libudev/libudev-list.c
@@ -95,7 +95,7 @@ static inline struct udev_list_entry *list_node_to_entry(struct udev_list_node *
void udev_list_init(struct udev *udev, struct udev_list *list, bool unique)
{
- memset(list, 0x00, sizeof(struct udev_list));
+ memzero(list, sizeof(struct udev_list));
list->udev = udev;
list->unique = unique;
udev_list_node_init(&list->node);
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index fa20a69e85..bd22741c66 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -291,7 +291,7 @@ _public_ int udev_monitor_filter_update(struct udev_monitor *udev_monitor)
udev_list_get_entry(&udev_monitor->filter_tag_list) == NULL)
return 0;
- memset(ins, 0x00, sizeof(ins));
+ memzero(ins, sizeof(ins));
i = 0;
/* load magic in A */
@@ -371,7 +371,7 @@ _public_ int udev_monitor_filter_update(struct udev_monitor *udev_monitor)
bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff);
/* install filter */
- memset(&filter, 0x00, sizeof(filter));
+ memzero(&filter, sizeof(filter));
filter.len = i;
filter.filter = ins;
err = setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter));
@@ -599,7 +599,7 @@ retry:
return NULL;
iov.iov_base = &buf;
iov.iov_len = sizeof(buf);
- memset (&smsg, 0x00, sizeof(struct msghdr));
+ memzero(&smsg, sizeof(struct msghdr));
smsg.msg_iov = &iov;
smsg.msg_iovlen = 1;
smsg.msg_control = cred_msg;
@@ -744,7 +744,7 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor,
return -EINVAL;
/* add versioned header */
- memset(&nlh, 0x00, sizeof(struct udev_monitor_netlink_header));
+ memzero(&nlh, sizeof(struct udev_monitor_netlink_header));
memcpy(nlh.prefix, "libudev", 8);
nlh.magic = htonl(UDEV_MONITOR_MAGIC);
nlh.header_size = sizeof(struct udev_monitor_netlink_header);
@@ -771,7 +771,7 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor,
iov[1].iov_base = (char *)buf;
iov[1].iov_len = blen;
- memset(&smsg, 0x00, sizeof(struct msghdr));
+ memzero(&smsg, sizeof(struct msghdr));
smsg.msg_iov = iov;
smsg.msg_iovlen = 2;
/*