[PATCH v4 11/12] libusbg: Replace memcpy with structure assignment.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use the assign operator for structure instead of using
memcpy with hard coded size.

Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>
---
 src/usbg.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/usbg.c b/src/usbg.c
index 71317f4..ac01e56 100644
--- a/src/usbg.c
+++ b/src/usbg.c
@@ -193,12 +193,12 @@ static void usbg_parse_function_attrs(struct function *f)
 		usbg_read_string(f->path, f->name, "dev_addr", str_addr);
 		addr = ether_aton(str_addr);
 		if (addr)
-			memcpy(&f->attr.net.dev_addr, addr, sizeof(struct ether_addr));
+			f->attr.net.dev_addr = *addr;
 
 		usbg_read_string(f->path, f->name, "host_addr", str_addr);
 		addr = ether_aton(str_addr);
 		if(addr)
-			memcpy(&f->attr.net.host_addr, addr, sizeof(struct ether_addr));
+			f->attr.net.host_addr = *addr;
 
 		usbg_read_string(f->path, f->name, "ifname", f->attr.net.ifname);
 		f->attr.net.qmult = usbg_read_dec(f->path, f->name, "qmult");
@@ -861,7 +861,7 @@ void usbg_set_net_dev_addr(struct function *f, struct ether_addr *dev_addr)
 {
 	char *str_addr;
 
-	memcpy(&f->attr.net.dev_addr, dev_addr, 6);
+	f->attr.net.dev_addr = *dev_addr;
 
 	str_addr = ether_ntoa(dev_addr);
 	usbg_write_string(f->path, f->name, "dev_addr", str_addr);
@@ -871,7 +871,7 @@ void usbg_set_net_host_addr(struct function *f, struct ether_addr *host_addr)
 {
 	char *str_addr;
 
-	memcpy(&f->attr.net.host_addr, host_addr, 6);
+	f->attr.net.host_addr = *host_addr;
 
 	str_addr = ether_ntoa(host_addr);
 	usbg_write_string(f->path, f->name, "host_addr", str_addr);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux