mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
To: barebox@lists.infradead.org
Cc: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Subject: [PATCH] show_progress: minor optimizations
Date: Tue,  6 Mar 2012 19:01:43 +0100	[thread overview]
Message-ID: <1331056903-3007-1-git-send-email-enrico.scholz@sigma-chemnitz.de> (raw)

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

                 reply	other threads:[~2012-03-06 18:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1331056903-3007-1-git-send-email-enrico.scholz@sigma-chemnitz.de \
    --to=enrico.scholz@sigma-chemnitz.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox