summaryrefslogtreecommitdiff
path: root/strbuf.h
diff options
context:
space:
mode:
authorAntoine Pelisse <apelisse@gmail.com>2013-04-10 21:03:23 +0200
committerJunio C Hamano <gitster@pobox.com>2013-04-10 12:58:33 -0700
commit079b546a2940a84989893254a318c8414e13a13e (patch)
tree5f8cc69cbfa12a63cf23b6dfdd75f92eefb4b9ef /strbuf.h
parentfa7285dc3dce8bd01fd8c665b032603ed55348e5 (diff)
downloadgit-079b546a2940a84989893254a318c8414e13a13e.tar.gz
strbuf: create strbuf_humanise_bytes() to show byte sizes
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 <apelisse@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'strbuf.h')
-rw-r--r--strbuf.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/strbuf.h b/strbuf.h
index 958822c2dd..73e80cea69 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -170,6 +170,7 @@ extern int strbuf_check_branch_ref(struct strbuf *sb, const char *name);
extern void strbuf_addstr_urlencode(struct strbuf *, const char *,
int reserved);
+extern void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes);
__attribute__((format (printf,1,2)))
extern int printf_ln(const char *fmt, ...);