]> git.gag.com Git - fw/openocd/commitdiff
hla: improve readability of struct hl_interface_s initialization
authorAntonio Borneo <borneo.antonio@gmail.com>
Mon, 16 Sep 2019 08:50:04 +0000 (10:50 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Mon, 25 Oct 2021 16:13:03 +0000 (16:13 +0000)
The initialization is barely readable, while actually only few
fields are set with value nor zero nor NULL.

Rewrite the initialization using C99 struct designations.

Change-Id: I4d288e6536ebe7110a184db6540223fc67361ec3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6636
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
src/jtag/hla/hla_interface.c

index b16a930a99c9984637b1b138284e3eb7b98561c1..fc362c0408079fffd351fc81e60dfe2a34fb278a 100644 (file)
 
 #include <target/target.h>
 
-static struct hl_interface_s hl_if = { {0, 0, { 0 }, { 0 }, HL_TRANSPORT_UNKNOWN, false, -1, false, 7184}, 0, 0 };
+static struct hl_interface_s hl_if = {
+       .param = {
+               .device_desc = NULL,
+               .serial = NULL,
+               .vid = { 0 },
+               .pid = { 0 },
+               .transport = HL_TRANSPORT_UNKNOWN,
+               .connect_under_reset = false,
+               .initial_interface_speed = -1,
+               .use_stlink_tcp = false,
+               .stlink_tcp_port = 7184,
+       },
+       .layout = NULL,
+       .handle = NULL,
+};
 
 int hl_interface_open(enum hl_transports tr)
 {