mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] show_progress: minor optimizations
@ 2012-03-06 18:01 Enrico Scholz
  0 siblings, 0 replies; only message in thread
From: Enrico Scholz @ 2012-03-06 18:01 UTC (permalink / raw)
  To: barebox; +Cc: Enrico Scholz

not really needed, patching was (probably) caused by miscompilation
with recent gcc, but bloat-o-meter reports

| show_progress                                220     192     -28

after this patch. The '#define' seems to be the only way to gain
this reduction; 'const' annotations do not have an effect with gcc
4.6 and 'static' will save the 28 bytes but adds other 5 ones.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
---
 lib/show_progress.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/show_progress.c b/lib/show_progress.c
index 39808d2..341184b 100644
--- a/lib/show_progress.c
+++ b/lib/show_progress.c
@@ -25,6 +25,7 @@
 #include <asm-generic/div64.h>
 
 #define HASHES_PER_LINE	65
+#define SPINCHR		"\\|/-"
 
 static int printed;
 static int progress_max;
@@ -32,10 +33,8 @@ static int spin;
 
 void show_progress(int now)
 {
-	char spinchr[] = "\\|/-";
-
 	if (now < 0) {
-		printf("%c\b", spinchr[spin++ % (sizeof(spinchr) - 1)]);
+		printf("%c\b", SPINCHR[spin++ % (sizeof(SPINCHR) - 1)]);
 		return;
 	}
 
-- 
1.7.7.6


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-03-06 18:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-06 18:01 [PATCH] show_progress: minor optimizations Enrico Scholz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox