ratelimit: drop use of goto
This commit is contained in:
+5
-10
@@ -10,6 +10,7 @@
|
||||
|
||||
bool ratelimit_below(RateLimit *r) {
|
||||
usec_t ts;
|
||||
bool good = false;
|
||||
|
||||
assert(r);
|
||||
|
||||
@@ -24,18 +25,12 @@ bool ratelimit_below(RateLimit *r) {
|
||||
|
||||
/* Reset counter */
|
||||
r->num = 0;
|
||||
goto good;
|
||||
}
|
||||
|
||||
if (r->num < r->burst)
|
||||
goto good;
|
||||
good = true;
|
||||
} else if (r->num < r->burst)
|
||||
good = true;
|
||||
|
||||
r->num++;
|
||||
return false;
|
||||
|
||||
good:
|
||||
r->num++;
|
||||
return true;
|
||||
return good;
|
||||
}
|
||||
|
||||
unsigned ratelimit_num_dropped(RateLimit *r) {
|
||||
|
||||
Reference in New Issue
Block a user