mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] progressbar: use __stringify in format string
@ 2012-10-20 11:15 Alexander Aring
  2012-10-20 12:13 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Aring @ 2012-10-20 11:15 UTC (permalink / raw)
  To: barebox

Use stringify in format string for HASH_PER_LINE.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 lib/show_progress.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/show_progress.c b/lib/show_progress.c
index d958a44..a43b4c9 100644
--- a/lib/show_progress.c
+++ b/lib/show_progress.c
@@ -20,6 +20,7 @@
 #include <common.h>
 #include <progress.h>
 #include <asm-generic/div64.h>
+#include <linux/stringify.h>
 
 #define HASHES_PER_LINE	65
 
@@ -56,7 +57,9 @@ void init_progression_bar(int max)
 	progress_max = max;
 	spin = 0;
 	if (progress_max)
-		printf("\t[%65s]\r\t[", "");
+		printf("\t[%"
+				__stringify(HASHES_PER_LINE)
+				"s]\r\t[", "");
 	else
 		printf("\t");
 }
-- 
1.7.12.4


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] progressbar: use __stringify in format string
  2012-10-20 11:15 [PATCH] progressbar: use __stringify in format string Alexander Aring
@ 2012-10-20 12:13 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-20 12:13 UTC (permalink / raw)
  To: Alexander Aring; +Cc: barebox

On 13:15 Sat 20 Oct     , Alexander Aring wrote:
> Use stringify in format string for HASH_PER_LINE.
> 
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
>  lib/show_progress.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/show_progress.c b/lib/show_progress.c
> index d958a44..a43b4c9 100644
> --- a/lib/show_progress.c
> +++ b/lib/show_progress.c
> @@ -20,6 +20,7 @@
>  #include <common.h>
>  #include <progress.h>
>  #include <asm-generic/div64.h>
> +#include <linux/stringify.h>
>  
>  #define HASHES_PER_LINE	65
>  
> @@ -56,7 +57,9 @@ void init_progression_bar(int max)
>  	progress_max = max;
>  	spin = 0;
>  	if (progress_max)
> -		printf("\t[%65s]\r\t[", "");
> +		printf("\t[%"
> +				__stringify(HASHES_PER_LINE)
> +				"s]\r\t[", "");
online is more readable

Best Regards,
J.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] progressbar: use __stringify in format string
  2012-10-21 20:59 Alexander Aring
@ 2012-10-23  6:25 ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2012-10-23  6:25 UTC (permalink / raw)
  To: Alexander Aring; +Cc: barebox

On Sun, Oct 21, 2012 at 10:59:06PM +0200, Alexander Aring wrote:
> Use stringify in format string for HASH_PER_LINE.
> 
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>

Applied, thanks.

Sascha

> ---
>  lib/show_progress.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/show_progress.c b/lib/show_progress.c
> index d958a44..bc067ea 100644
> --- a/lib/show_progress.c
> +++ b/lib/show_progress.c
> @@ -20,6 +20,7 @@
>  #include <common.h>
>  #include <progress.h>
>  #include <asm-generic/div64.h>
> +#include <linux/stringify.h>
>  
>  #define HASHES_PER_LINE	65
>  
> @@ -56,7 +57,7 @@ void init_progression_bar(int max)
>  	progress_max = max;
>  	spin = 0;
>  	if (progress_max)
> -		printf("\t[%65s]\r\t[", "");
> +		printf("\t[%"__stringify(HASHES_PER_LINE)"s]\r\t[", "");
>  	else
>  		printf("\t");
>  }
> -- 
> 1.7.12.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] progressbar: use __stringify in format string
@ 2012-10-21 20:59 Alexander Aring
  2012-10-23  6:25 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Aring @ 2012-10-21 20:59 UTC (permalink / raw)
  To: barebox

Use stringify in format string for HASH_PER_LINE.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 lib/show_progress.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/show_progress.c b/lib/show_progress.c
index d958a44..bc067ea 100644
--- a/lib/show_progress.c
+++ b/lib/show_progress.c
@@ -20,6 +20,7 @@
 #include <common.h>
 #include <progress.h>
 #include <asm-generic/div64.h>
+#include <linux/stringify.h>
 
 #define HASHES_PER_LINE	65
 
@@ -56,7 +57,7 @@ void init_progression_bar(int max)
 	progress_max = max;
 	spin = 0;
 	if (progress_max)
-		printf("\t[%65s]\r\t[", "");
+		printf("\t[%"__stringify(HASHES_PER_LINE)"s]\r\t[", "");
 	else
 		printf("\t");
 }
-- 
1.7.12.4


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-23  6:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-20 11:15 [PATCH] progressbar: use __stringify in format string Alexander Aring
2012-10-20 12:13 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-21 20:59 Alexander Aring
2012-10-23  6:25 ` Sascha Hauer

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