From 0ddb7c1f41822323551dc79cc265908d758179f4 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 21 May 2024 05:09:49 +0200 Subject: [PATCH] Removed usage of GOTO in WifiClient.cpp (#228) * Removed GOTO Couldn't help myself * Coding style * Small coding style oversight Why am I wasting time. --- .../hardware/libraries/WiFi/src/WiFiClient.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Arduino_package/hardware/libraries/WiFi/src/WiFiClient.cpp b/Arduino_package/hardware/libraries/WiFi/src/WiFiClient.cpp index bd4e1590..f2a47c45 100644 --- a/Arduino_package/hardware/libraries/WiFi/src/WiFiClient.cpp +++ b/Arduino_package/hardware/libraries/WiFi/src/WiFiClient.cpp @@ -45,21 +45,17 @@ uint8_t WiFiClient::connected() { } int WiFiClient::available() { - int ret = 0; - int err; - - if (!_is_connected) { + if (!_is_connected || _sock < 0) { return 0; } - if (_sock >= 0) { - try_again: - ret = clientdrv.availData(_sock); - if (ret > 0) { + + while(true){ + if (clientdrv.availData(_sock) > 0) { return 1; } else { - err = clientdrv.getLastErrno(_sock); + int err = clientdrv.getLastErrno(_sock); if (err == EAGAIN) { - goto try_again; + continue; } if (err != 0) { _is_connected = false; @@ -67,8 +63,6 @@ int WiFiClient::available() { return 0; } } - - return 0; } int WiFiClient::read() {