فهرست منبع

Cleanup: Remove duplicate initialisation of ENIPMessage structures

At some points in the code ENIPMessage outgoing_message structures have been
initialized during declaration with "= {0}". But the following call of
InitializeENIPMessage() does a memset() with zero anyway.

Removed the duplicate initialization from the variable definition.

Signed-off-by: Stefan Mätje <stefan.maetje@esd.eu>
Stefan Mätje 6 سال پیش
والد
کامیت
828e3703fb
2فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 1 1
      source/src/cip/cipioconnection.c
  2. 1 1
      source/src/ports/generic_networkhandler.c

+ 1 - 1
source/src/cip/cipioconnection.c

@@ -823,7 +823,7 @@ EipStatus SendConnectedData(CipConnectionObject *connection_object) {
   common_packet_format_data->address_info_item[0].type_id = 0;
   common_packet_format_data->address_info_item[1].type_id = 0;
 
-  ENIPMessage outgoing_message = {0};
+  ENIPMessage outgoing_message;
   InitializeENIPMessage(&outgoing_message);
   EipUint16 reply_length = AssembleIOMessage(common_packet_format_data,
                                              &outgoing_message);

+ 1 - 1
source/src/ports/generic_networkhandler.c

@@ -814,7 +814,7 @@ EipStatus HandleDataOnTcpSocket(int socket) {
       FreeErrorMessage(error_message);
     }
 
-    ENIPMessage outgoing_message = {0};
+    ENIPMessage outgoing_message;
     InitializeENIPMessage(&outgoing_message);
     EipStatus need_to_send = HandleReceivedExplictTcpData(
       socket, incoming_message, data_size, &remaining_bytes,