• Antoine Pelisse's avatar
    strbuf: create strbuf_humanise_bytes() to show byte sizes · 079b546a
    Antoine Pelisse authored
    Humanization of downloaded size is done in the same function as text
    formatting in 'process.c'. The code cannot be reused easily elsewhere.
    
    Separate text formatting from size simplification and make the
    function public in strbuf so that it can easily be used by other
    callers.
    
    We now can use strbuf_humanise_bytes() for both downloaded size and
    download speed calculation. One of the drawbacks is that speed will
    now look like this when download is stalled: "0 bytes/s" instead of
    "0 KiB/s".
    Signed-off-by: Antoine Pelisse's avatarAntoine Pelisse <[email protected]>
    Signed-off-by: default avatarJunio C Hamano <[email protected]>
    079b546a
strbuf.c 11.6 KB