mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: Alexander Aring <alex.aring@googlemail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] progressbar: add TOSTRING macro
Date: Sat, 20 Oct 2012 12:48:46 +0200	[thread overview]
Message-ID: <20121020104846.GB21588@game.jcrosoft.org> (raw)
In-Reply-To: <1350715865-4252-2-git-send-email-alex.aring@gmail.com>

On 08:51 Sat 20 Oct     , Alexander Aring wrote:
> Add TOSTRING macro in common.h and use it for
> HASH_PER_LINE in printf format string of
> function init_progression_bar.
> 
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
>  include/common.h    | 5 +++++
>  lib/show_progress.c | 2 +-
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/include/common.h b/include/common.h
> index c1f44b4..ffdfcd9 100644
> --- a/include/common.h
> +++ b/include/common.h
> @@ -256,4 +256,9 @@ static inline void barebox_banner(void) {}
>  		(__x < 0) ? -__x : __x;         \
>  	})
>  
> +/* Convert a number define to
> + * const char* with concat */
> +#define STRINGIFY(x) #x
> +#define TOSTRING(x) STRINGIFY(x)
> +
>  #endif	/* __COMMON_H_ */
> diff --git a/lib/show_progress.c b/lib/show_progress.c
> index d958a44..eca7e1e 100644
> --- a/lib/show_progress.c
> +++ b/lib/show_progress.c
> @@ -56,7 +56,7 @@ void init_progression_bar(int max)
>  	progress_max = max;
>  	spin = 0;
>  	if (progress_max)
> -		printf("\t[%65s]\r\t[", "");
> +		printf("\t[%"TOSTRING(HASHES_PER_LINE)"s]\r\t[", "");
no we have __stringify

Best Regards,
J.
>  	else
>  		printf("\t");
>  }
> -- 
> 1.7.12.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

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

  reply	other threads:[~2012-10-20 10:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-20  6:51 [PATCH 1/2] nandtest: improve nandtest command Alexander Aring
2012-10-20  6:51 ` [PATCH 2/2] progressbar: add TOSTRING macro Alexander Aring
2012-10-20 10:48   ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-10-20 12:12 ` [PATCH 1/2] nandtest: improve nandtest command Jean-Christophe PLAGNIOL-VILLARD

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=20121020104846.GB21588@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.com \
    --cc=alex.aring@googlemail.com \
    --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