Skip to content

pr-846/adlternative/strbuf_read_optimization-v1

From: ZheNing Hu <adlternative@gmail.com>

the usage in strbuf.h tell us"Alloc is somehow a
"private" member that should not be messed with.
use `strbuf_avail()`instead."

I notice that `strbuf_read` and `strbuf_read_once` may
use "sb->alloc - sb->len - 1" instead of using
`strbuf_avail()`,so I change it,in the same time,
I change `sb->len+= got` to `strbuf_setlen()`,it may
better to use existing api.

Signed-off-by: ZheNing Hu <adlternative@gmail.com>

Submitted-As: https://lore.kernel.org/git/pull.846.git.1611637582625.gitgitgadget@gmail.com
Assets 2