On Wednesday, 12 January 2022 22:05:06 CET Marek Lindner wrote: [...]
diff --git a/client.c b/client.c index b5d8943..cf15ff4 100644 --- a/client.c +++ b/client.c @@ -35,6 +35,7 @@ int alfred_client_request_data(struct globals *globals) return -1;
len = sizeof(request);
memset(&request, 0, len);
request.header.type = ALFRED_REQUEST; request.header.version = ALFRED_VERSION;
All bytes (also all bits) are overwritten in the lines below the memset. So I don't see why memset would be required here.
@@ -184,6 +185,7 @@ int alfred_client_modeswitch(struct globals *globals) return -1;
len = sizeof(modeswitch);
memset(&modeswitch, 0, len);
modeswitch.header.type = ALFRED_MODESWITCH; modeswitch.header.version = ALFRED_VERSION;
Same here - with a minor exception. When mode is not written then the data is not written to the socket.
@@ -260,6 +262,7 @@ int alfred_client_change_interface(struct globals *globals) }
len = sizeof(change_interface);
memset(&change_interface, 0, len);
change_interface.header.type = ALFRED_CHANGE_INTERFACE; change_interface.header.version = ALFRED_VERSION;\
Same here.
@@ -308,6 +311,7 @@ int alfred_client_change_bat_iface(struct globals *globals) }
len = sizeof(change_bat_iface);
memset(&change_bat_iface, 0, len);
change_bat_iface.header.type = ALFRED_CHANGE_BAT_IFACE; change_bat_iface.header.version = ALFRED_VERSION;
Same here.
Kind regards, Sven