Skip to content

Commit d899135

Browse files
committed
[nrf fromtree] samples: net: echo_client: Fix 'Tag name should be unique' error
Refactor the code to comply with: Violation to rule 5.7 (Tag name should be unique) tag: data Rename the structure to avoid excessive refactoring. Signed-off-by: Robert Lubos <[email protected]> (cherry picked from commit 7b854d8)
1 parent 9397e35 commit d899135

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

samples/net/sockets/echo_client/src/common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct udp_control {
4242
struct k_timer rx_timer;
4343
};
4444

45-
struct data {
45+
struct sample_data {
4646
const char *proto;
4747

4848
struct {
@@ -62,8 +62,8 @@ struct data {
6262
};
6363

6464
struct configs {
65-
struct data ipv4;
66-
struct data ipv6;
65+
struct sample_data ipv4;
66+
struct sample_data ipv6;
6767
};
6868

6969
#if !defined(CONFIG_NET_CONFIG_PEER_IPV4_ADDR)

samples/net/sockets/echo_client/src/tcp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static ssize_t sendall(int sock, const void *buf, size_t len)
4747
return 0;
4848
}
4949

50-
static int send_tcp_data(struct data *data)
50+
static int send_tcp_data(struct sample_data *data)
5151
{
5252
int ret;
5353

@@ -72,7 +72,7 @@ static int send_tcp_data(struct data *data)
7272
return ret;
7373
}
7474

75-
static int compare_tcp_data(struct data *data, const char *buf, uint32_t received)
75+
static int compare_tcp_data(struct sample_data *data, const char *buf, uint32_t received)
7676
{
7777
if (data->tcp.received + received > data->tcp.expecting) {
7878
LOG_ERR("Too much data received: TCP %s", data->proto);
@@ -87,7 +87,7 @@ static int compare_tcp_data(struct data *data, const char *buf, uint32_t receive
8787
return 0;
8888
}
8989

90-
static int start_tcp_proto(struct data *data, sa_family_t family,
90+
static int start_tcp_proto(struct sample_data *data, sa_family_t family,
9191
struct sockaddr *addr, socklen_t addrlen)
9292
{
9393
int optval;
@@ -180,7 +180,7 @@ static int start_tcp_proto(struct data *data, sa_family_t family,
180180
return ret;
181181
}
182182

183-
static int process_tcp_proto(struct data *data)
183+
static int process_tcp_proto(struct sample_data *data)
184184
{
185185
int ret, received;
186186
char buf[RECV_BUF_SIZE];

samples/net/sockets/echo_client/src/udp.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static struct k_thread udp_tx_thread;
3636
static struct udp_control udp4_ctrl, udp6_ctrl;
3737
static struct k_poll_signal udp_kill;
3838

39-
static int send_udp_data(struct data *data);
39+
static int send_udp_data(struct sample_data *data);
4040
static void wait_reply(struct k_timer *timer);
4141
static void wait_transmit(struct k_timer *timer);
4242

@@ -136,7 +136,7 @@ void init_udp(void)
136136
}
137137
}
138138

139-
static int send_udp_data(struct data *data)
139+
static int send_udp_data(struct sample_data *data)
140140
{
141141
int ret;
142142

@@ -156,7 +156,7 @@ static int send_udp_data(struct data *data)
156156
return ret < 0 ? -EIO : 0;
157157
}
158158

159-
static int compare_udp_data(struct data *data, const char *buf, uint32_t received)
159+
static int compare_udp_data(struct sample_data *data, const char *buf, uint32_t received)
160160
{
161161
if (received != data->udp.expecting) {
162162
LOG_ERR("Invalid amount of data received: UDP %s", data->proto);
@@ -175,7 +175,7 @@ static void wait_reply(struct k_timer *timer)
175175
{
176176
/* This means that we did not receive response in time. */
177177
struct udp_control *ctrl = CONTAINER_OF(timer, struct udp_control, rx_timer);
178-
struct data *data = (ctrl == conf.ipv4.udp.ctrl) ? &conf.ipv4 : &conf.ipv6;
178+
struct sample_data *data = (ctrl == conf.ipv4.udp.ctrl) ? &conf.ipv4 : &conf.ipv6;
179179

180180
LOG_ERR("UDP %s: Data packet not received", data->proto);
181181

@@ -190,7 +190,7 @@ static void wait_transmit(struct k_timer *timer)
190190
k_poll_signal_raise(&ctrl->tx_signal, 0);
191191
}
192192

193-
static int start_udp_proto(struct data *data, sa_family_t family,
193+
static int start_udp_proto(struct sample_data *data, sa_family_t family,
194194
struct sockaddr *addr, socklen_t addrlen)
195195
{
196196
int optval;
@@ -251,7 +251,7 @@ static int start_udp_proto(struct data *data, sa_family_t family,
251251
return ret;
252252
}
253253

254-
static int process_udp_proto(struct data *data)
254+
static int process_udp_proto(struct sample_data *data)
255255
{
256256
int ret, received;
257257

0 commit comments

Comments
 (0)