mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
CLEANUP: hpack: remove a redundant test in the decoder
As reported in issue #485 the test for !len at the end of the loop in get_var_int() is useless since it was already done inside the loop. Actually the code is more readable if we remove the first one so let's do this instead. The resulting code is exactly the same since the compiler already optimized the test away.
This commit is contained in:
parent
4dd145a888
commit
077d366ef7
@ -65,11 +65,7 @@ static uint32_t get_var_int(const uint8_t **raw_in, uint32_t *len_in, int b)
|
||||
if (ret != (uint32_t)((1 << b) - 1))
|
||||
goto end;
|
||||
|
||||
while (1) {
|
||||
if (!len)
|
||||
goto too_short;
|
||||
if (!(*raw & 128))
|
||||
break;
|
||||
while (len && (*raw & 128)) {
|
||||
ret += ((uint32_t)(*raw++) & 127) << shift;
|
||||
shift += 7;
|
||||
len--;
|
||||
|
Loading…
Reference in New Issue
Block a user