Mercurial > prosody-hg
comparison util/dbuffer.lua @ 12762:79b89f382290
util.dbuffer: Remove redundant code (read_chunk() cannot fail at this point)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 11 Oct 2022 11:34:47 +0100 |
| parents | 19cddf92fcc2 |
| children | d26eefe98d09 |
comparison
equal
deleted
inserted
replaced
| 12761:82915c755d90 | 12762:79b89f382290 |
|---|---|
| 94 if requested_bytes > self._length then | 94 if requested_bytes > self._length then |
| 95 return nil; | 95 return nil; |
| 96 end | 96 end |
| 97 | 97 |
| 98 local chunk, read_bytes = self:read_chunk(requested_bytes); | 98 local chunk, read_bytes = self:read_chunk(requested_bytes); |
| 99 if chunk then | 99 requested_bytes = requested_bytes - read_bytes; |
| 100 requested_bytes = requested_bytes - read_bytes; | 100 if requested_bytes == 0 then -- Already read everything we need |
| 101 if requested_bytes == 0 then -- Already read everything we need | 101 return true; |
| 102 return true; | |
| 103 end | |
| 104 else | |
| 105 return nil; | |
| 106 end | 102 end |
| 107 | 103 |
| 108 while chunk do | 104 while chunk do |
| 109 if requested_bytes > 0 then | 105 if requested_bytes > 0 then |
| 110 chunk, read_bytes = self:read_chunk(requested_bytes); | 106 chunk, read_bytes = self:read_chunk(requested_bytes); |
