8000 Remove alwaysExpired, it is identical to 0 and obfuscates the code. · dok-net/arduino-esp8266@292c7cc · GitHub
[go: up one dir, main page]

Skip to content

Commit 292c7cc

Browse files
committed
Remove alwaysExpired, it is identical to 0 and obfuscates the code.
1 parent 496d557 commit 292c7cc

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

cores/esp8266/PolledTimeout.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ class timeoutTemplate
146146
using timeType = typename TimePolicyT::timeType;
147147
static_assert(std::is_unsigned<timeType>::value == true, "timeType must be unsigned");
148148

149-
static constexpr timeType alwaysExpired = 0;
150149
static constexpr timeType neverExpires = std::numeric_limits<timeType>::max();
151150
static constexpr timeType rangeCompensate = TimePolicyT::rangeCompensate; //debug
152151

@@ -177,7 +176,7 @@ class timeoutTemplate
177176

178177
bool canWait () const
179178
{
180-
return _timeout != alwaysExpired && !_oneShotExpired;
179+
return _timeout != 0 && !_oneShotExpired;
181180
}
182181

183182
// Resets, will trigger after this new timeout.
@@ -216,7 +215,7 @@ class timeoutTemplate
216215

217216
void resetToNeverExpires ()
218217
{
219-
_timeout = alwaysExpired + 1; // because canWait() has precedence
218+
_timeout = 1; // because canWait() has precedence
220219
_neverExpires = true;
221220
}
222221

cores/esp8266/Stream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class Stream: public Print {
171171

172172
// transfers already buffered / immediately available data (no timeout)
173173
// returns number of transferred bytes
174-
[[deprecated]] size_t sendAvailable (Print* to) { return sendGeneric(to, -1, -1, oneShotMs::alwaysExpired); }
174+
[[deprecated]] size_t sendAvailable (Print* to) { return sendGeneric(to, -1, -1, 0); }
175175
[[deprecated]] size_t sendAvailable (Print& to) { return sendAvailable(&to); }
176176

177177
// transfers data until timeout

0 commit comments

Comments
 (0)
0