summaryrefslogtreecommitdiff
path: root/src/libudev
diff options
context:
space:
mode:
authorGreg KH <gregkh@linuxfoundation.org>2014-01-31 06:51:32 +0100
committerTom Gundersen <teg@jklm.no>2014-01-31 11:55:01 +0100
commit29804cc1e0f37ee34301530fd7f1eb8550be464e (patch)
treeba287b984b216279bb342579a9d1039383ca3a39 /src/libudev
parentb5cfa7408c4cb68e9bb232fc34b07fd03c915617 (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).
Diffstat (limited to 'src/libudev')
-rw-r--r--src/libudev/libudev-device.c2
-rw-r--r--src/libudev/libudev-list.c2
-rw-r--r--src/libudev/libudev-monitor.c10
3 files changed, 7 insertions, 7 deletions
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 ea7263f280..f976da0b8a 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;
/*