Skip to content

Commit d03f089

Browse files
committed
cc3200/mods/modusocket: Init vars to 0 to silence compiler warnings.
Some compilers can't analyse the code to determine that these variables are always set before being used.
1 parent e859ddf commit d03f089

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cc3200/mods/modusocket.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
422422
mp_uint_t port = netutils_parse_inet_addr(addr_in, ip, NETUTILS_LITTLE);
423423

424424
// call the NIC to bind the socket
425-
int _errno;
425+
int _errno = 0;
426426
if (wlan_socket_bind(self, ip, port, &_errno) != 0) {
427427
mp_raise_OSError(-_errno);
428428
}
@@ -459,8 +459,8 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
459459

460460
// accept the incoming connection
461461
uint8_t ip[MOD_NETWORK_IPV4ADDR_BUF_SIZE];
462-
mp_uint_t port;
463-
int _errno;
462+
mp_uint_t port = 0;
463+
int _errno = 0;
464464
if (wlan_socket_accept(self, socket2, ip, &port, &_errno) != 0) {
465465
mp_raise_OSError(-_errno);
466466
}
@@ -546,7 +546,7 @@ STATIC mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_
546546
mp_uint_t port = netutils_parse_inet_addr(addr_in, ip, NETUTILS_LITTLE);
547547

548548
// call the nic to sendto
549-
int _errno;
549+
int _errno = 0;
550550
mp_int_t ret = wlan_socket_sendto(self, bufinfo.buf, bufinfo.len, ip, port, &_errno);
551551
if (ret < 0) {
552552
mp_raise_OSError(-_errno);
@@ -561,8 +561,8 @@ STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
561561
vstr_t vstr;
562562
vstr_init_len(&vstr, mp_obj_get_int(len_in));
563563
byte ip[4];
564-
mp_uint_t port;
565-
int _errno;
564+
mp_uint_t port = 0;
565+
int _errno = 0;
566566
mp_int_t ret = wlan_socket_recvfrom(self, (byte*)vstr.buf, vstr.len, ip, &port, &_errno);
567567
if (ret < 0) {
568568
if (_errno == MP_EAGAIN && self->sock_base.has_timeout) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy