diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-02-11 20:56:13 +0300 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-02-11 20:56:13 +0300 |
commit | d55e13964916af6a083be881bffdb493af287c1d (patch) | |
tree | 399af6f19989d3efedb0a66f0e7b99184b245bb9 /include | |
parent | e52e67cb512e775fd83ca399cc807c363ba59dcc (diff) |
progress meter: move file name to bb_progress_t. +20 bytes
We were doing expensive unicode conversion on every update
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/libbb.h b/include/libbb.h index c0178801f..7581cd4c4 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1587,15 +1587,21 @@ typedef struct bb_progress_t { off_t lastsize; unsigned lastupdate_sec; unsigned start_sec; - smallint inited; + const char *curfile; } bb_progress_t; -void bb_progress_init(bb_progress_t *p) FAST_FUNC; -void bb_progress_update(bb_progress_t *p, const char *curfile, +#define is_bb_progress_inited(p) ((p)->curfile != NULL) +#define bb_progress_free(p) do { \ + if (ENABLE_UNICODE_SUPPORT) free((char*)((p)->curfile)); \ + (p)->curfile = NULL; \ +} while (0) +void bb_progress_init(bb_progress_t *p, const char *curfile) FAST_FUNC; +void bb_progress_update(bb_progress_t *p, uoff_t beg_range, uoff_t transferred, uoff_t totalsize) FAST_FUNC; + extern const char *applet_name; /* Some older linkers don't perform string merging, we used to have common strings |