From d55e13964916af6a083be881bffdb493af287c1d Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 11 Feb 2011 18:56:13 +0100 Subject: 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 --- include/libbb.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'include') 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 -- cgit v1.2.3