Skip to content

Commit

Permalink
fix dormant astyle issues (2)
Browse files Browse the repository at this point in the history
Following the useless code delimiter removal, some .c files which
contained astyle issues on main were modified so astyle was run on
them and found the issues.

Signed-off-by: Darius Berghe <[email protected]>
  • Loading branch information
buha committed Feb 24, 2025
1 parent 715c737 commit a2627e9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
39 changes: 20 additions & 19 deletions network/linux_socket/linux_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ static int32_t linux_socket_open(void *desc, uint32_t *sock_id,
int32_t flags;
int err;

err = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
if(err < 0)
err = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (err < 0)
return err;

*sock_id = err;
Expand All @@ -74,7 +74,7 @@ static int32_t linux_socket_close(void *desc, uint32_t sock_id)
int32_t ret;

ret = close(sock_id);
if(ret < 0)
if (ret < 0)
return -errno;

return ret;
Expand All @@ -94,9 +94,9 @@ static int32_t linux_socket_connect(void *desc, uint32_t sock_id,
saddr.sin_addr.s_addr = ((struct in_addr*) hptr->h_addr_list[0])->s_addr;
socklen_t len = sizeof(saddr);

ret = connect(sock_id,(struct sockaddr*) &saddr,len);
ret = connect(sock_id, (struct sockaddr*) &saddr, len);

if(ret < 0)
if (ret < 0)
return -errno;

return ret;
Expand All @@ -111,7 +111,7 @@ static int32_t linux_socket_disconnect(void *desc,

ret = linux_socket_close(desc, sock_id);

if(ret < 0)
if (ret < 0)
return -errno;

return 0;
Expand All @@ -125,7 +125,7 @@ static int32_t linux_socket_send(void *desc, uint32_t sock_id,

ret = send(sock_id, data, size, 0);

if(ret < 0)
if (ret < 0)
return -errno;

return size;
Expand All @@ -141,11 +141,11 @@ static int32_t linux_socket_recv(void *desc, uint32_t sock_id,
return size;

ret = recv(sock_id, data, size, MSG_DONTWAIT);
if(ret < 0)
if (ret < 0)
return -errno;

/* A stream socket peer has performed an orderly shutdown */
if(ret == 0)
if (ret == 0)
return -ENOTCONN;

return ret;
Expand All @@ -169,7 +169,7 @@ static int32_t linux_socket_sendto(void *desc, uint32_t sock_id,

ret = sendto(sock_id, data, size, 0, (struct sockaddr*) &saddr_to, len);

if(ret != 0)
if (ret != 0)
return ret;

return 0;
Expand All @@ -191,10 +191,11 @@ static int32_t linux_socket_recvfrom(void *desc, uint32_t sock_id,
saddr_from.sin_addr.s_addr = ((struct in_addr*) hptr->h_addr_list[0])->s_addr;
len = sizeof(saddr_from);

ret = recvfrom(sock_id, data, size, MSG_DONTWAIT,(struct sockaddr*) &saddr_from,
ret = recvfrom(sock_id, data, size, MSG_DONTWAIT,
(struct sockaddr*) &saddr_from,
&len);

if(ret != 0)
if (ret != 0)
return ret;

return 0;
Expand All @@ -215,7 +216,7 @@ static int32_t linux_socket_bind(void *desc, uint32_t sock_id,

ret = bind(sock_id, (struct sockaddr*) &saddr, len);

if(ret < 0)
if (ret < 0)
return -errno;

return ret;
Expand All @@ -229,7 +230,7 @@ static int32_t linux_socket_listen(void *desc, uint32_t sock_id,

ret = listen(sock_id, back_log);

if(ret < 0)
if (ret < 0)
return -errno;

return ret;
Expand All @@ -243,7 +244,7 @@ static int32_t linux_socket_accept(void *desc, uint32_t sock_id,

ret = accept4(sock_id, NULL, NULL, SOCK_NONBLOCK);

if(ret < 0)
if (ret < 0)
return -errno;

*client_socket_id = ret;
Expand All @@ -255,15 +256,15 @@ struct network_interface linux_net = {
.socket_open = (int32_t (*)(void *, uint32_t *, enum socket_protocol,
uint32_t)) linux_socket_open,
.socket_close = (int32_t (*)(void *, uint32_t)) linux_socket_close,
.socket_connect = (int32_t (*)(void *, uint32_t,struct socket_address *))linux_socket_connect,
.socket_connect = (int32_t (*)(void *, uint32_t, struct socket_address *))linux_socket_connect,
.socket_disconnect = (int32_t (*)(void *, uint32_t))linux_socket_disconnect,
.socket_send = (int32_t (*)(void *, uint32_t, const void *, uint32_t))linux_socket_send,
.socket_recv = (int32_t (*)(void *, uint32_t, void *, uint32_t))linux_socket_recv,
.socket_sendto = (int32_t (*)(void *, uint32_t, const void *, uint32_t, const struct socket_address* to))linux_socket_sendto,
.socket_recvfrom = (int32_t (*)(void *, uint32_t, void *, uint32_t, struct socket_address* from))linux_socket_recvfrom,
.socket_sendto = (int32_t (*)(void *, uint32_t, const void *, uint32_t, const struct socket_address * to))linux_socket_sendto,
.socket_recvfrom = (int32_t (*)(void *, uint32_t, void *, uint32_t, struct socket_address * from))linux_socket_recvfrom,
.socket_bind = (int32_t (*)(void *, uint32_t, uint16_t))linux_socket_bind,
.socket_listen = (int32_t (*)(void *, uint32_t, uint32_t))linux_socket_listen,
.socket_accept= (int32_t (*)(void *, uint32_t, uint32_t*))linux_socket_accept
.socket_accept = (int32_t (*)(void *, uint32_t, uint32_t*))linux_socket_accept
};

#endif
8 changes: 4 additions & 4 deletions network/wifi/at_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ struct at_desc {
/* Variable where current message length is built */
uint32_t ipd_len;
/* Will be called when a new connection is created or closed */
void (*connection_callback)(void *ctx, enum at_event,
uint32_t conn_id, struct no_os_circular_buffer **cb);
void (*connection_callback)(void *ctx, enum at_event,
uint32_t conn_id, struct no_os_circular_buffer **cb);
/* Context that will be passed to the callback */
void *callback_ctx;
};
Expand Down Expand Up @@ -567,7 +567,7 @@ static void set_params(struct at_buff *dest, uint8_t *fmt, ...)
uint32_t i;
int32_t nb = 0;

va_start (args, fmt);
va_start(args, fmt);
while (*fmt) {
switch (*fmt) {
case 'd':
Expand Down Expand Up @@ -597,7 +597,7 @@ static void set_params(struct at_buff *dest, uint8_t *fmt, ...)
dest->buff[dest->len++] = ',';
}

va_end (args);
va_end(args);
}

/* Concatenate command parameters to desc->cmd */
Expand Down

0 comments on commit a2627e9

Please sign in to comment.