diff mbox series

[3/5] test_printf: Remove custom appending of '|'

Message ID 20211012182647.1605095-4-willy@infradead.org (mailing list archive)
State New
Headers show
Series Improvements to %pGp | expand

Commit Message

Matthew Wilcox Oct. 12, 2021, 6:26 p.m. UTC
Instead of having an ifdef to decide whether to print a |, use the
'append' functionality of the main loop to print it.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 lib/test_printf.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Yafang Shao Oct. 13, 2021, 5:21 a.m. UTC | #1
On Wed, Oct 13, 2021 at 2:32 AM Matthew Wilcox (Oracle)
<willy@infradead.org> wrote:
>
> Instead of having an ifdef to decide whether to print a |, use the
> 'append' functionality of the main loop to print it.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Reviewed-by: Yafang Shao <laoar.shao@gmail.com>

> ---
>  lib/test_printf.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/lib/test_printf.c b/lib/test_printf.c
> index f744b0498672..60cdf4ba991e 100644
> --- a/lib/test_printf.c
> +++ b/lib/test_printf.c
> @@ -616,12 +616,7 @@ page_flags_test(int section, int node, int zone, int last_cpupid,
>         if (flags & PAGEFLAGS_MASK) {
>                 snprintf(cmp_buf + size, BUF_SIZE - size, "%s", name);
>                 size = strlen(cmp_buf);
> -#if SECTIONS_WIDTH || NODES_WIDTH || ZONES_WIDTH || \
> -       LAST_CPUPID_WIDTH || KASAN_TAG_WIDTH
> -               /* Other information also included in page flags */
> -               snprintf(cmp_buf + size, BUF_SIZE - size, "|");
> -               size = strlen(cmp_buf);
> -#endif
> +               append = true;
>         }
>
>         for (i = 0; i < ARRAY_SIZE(pft); i++) {
> --
> 2.32.0
>
Petr Mladek Oct. 15, 2021, 10:23 a.m. UTC | #2
On Wed 2021-10-13 13:21:15, Yafang Shao wrote:
> On Wed, Oct 13, 2021 at 2:32 AM Matthew Wilcox (Oracle)
> <willy@infradead.org> wrote:
> >
> > Instead of having an ifdef to decide whether to print a |, use the
> > 'append' functionality of the main loop to print it.
> >
> > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> 
> Reviewed-by: Yafang Shao <laoar.shao@gmail.com>

Makes sense.

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr
Anshuman Khandual Oct. 18, 2021, 5:41 a.m. UTC | #3
On 10/12/21 11:56 PM, Matthew Wilcox (Oracle) wrote:
> Instead of having an ifdef to decide whether to print a |, use the
> 'append' functionality of the main loop to print it.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>  lib/test_printf.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/lib/test_printf.c b/lib/test_printf.c
> index f744b0498672..60cdf4ba991e 100644
> --- a/lib/test_printf.c
> +++ b/lib/test_printf.c
> @@ -616,12 +616,7 @@ page_flags_test(int section, int node, int zone, int last_cpupid,
>  	if (flags & PAGEFLAGS_MASK) {
>  		snprintf(cmp_buf + size, BUF_SIZE - size, "%s", name);
>  		size = strlen(cmp_buf);
> -#if SECTIONS_WIDTH || NODES_WIDTH || ZONES_WIDTH || \
> -	LAST_CPUPID_WIDTH || KASAN_TAG_WIDTH
> -		/* Other information also included in page flags */
> -		snprintf(cmp_buf + size, BUF_SIZE - size, "|");
> -		size = strlen(cmp_buf);
> -#endif
> +		append = true;
>  	}
>  
>  	for (i = 0; i < ARRAY_SIZE(pft); i++) {
> 

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
diff mbox series

Patch

diff --git a/lib/test_printf.c b/lib/test_printf.c
index f744b0498672..60cdf4ba991e 100644
--- a/lib/test_printf.c
+++ b/lib/test_printf.c
@@ -616,12 +616,7 @@  page_flags_test(int section, int node, int zone, int last_cpupid,
 	if (flags & PAGEFLAGS_MASK) {
 		snprintf(cmp_buf + size, BUF_SIZE - size, "%s", name);
 		size = strlen(cmp_buf);
-#if SECTIONS_WIDTH || NODES_WIDTH || ZONES_WIDTH || \
-	LAST_CPUPID_WIDTH || KASAN_TAG_WIDTH
-		/* Other information also included in page flags */
-		snprintf(cmp_buf + size, BUF_SIZE - size, "|");
-		size = strlen(cmp_buf);
-#endif
+		append = true;
 	}
 
 	for (i = 0; i < ARRAY_SIZE(pft); i++) {