[PATCH 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/gadget.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gadget.c b/src/gadget.c
index 2bc4f2e..005d9b0 100644
--- a/src/gadget.c
+++ b/src/gadget.c
@@ -193,12 +193,12 @@ static void gadget_parse_function_attrs(struct function *f)
 		gadget_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;
 
 		gadget_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;
 
 		gadget_read_string(f->path, f->name, "ifname", f->attr.net.ifname);
 		f->attr.net.qmult = gadget_read_dec(f->path, f->name, "qmult");
@@ -862,7 +862,7 @@ void gadget_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);
 	gadget_write_string(f->path, f->name, "dev_addr", str_addr);
@@ -872,7 +872,7 @@ void gadget_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);
 	gadget_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