All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] accessibility: Use str_plural() to simplify the code
@ 2025-08-07  8:59 Xichao Zhao
  2025-08-07  9:17 ` Samuel Thibault
  0 siblings, 1 reply; 2+ messages in thread
From: Xichao Zhao @ 2025-08-07  8:59 UTC (permalink / raw)
  To: w.d.hubbs, chris, kirk, samuel.thibault
  Cc: speakup, linux-kernel, Xichao Zhao

Use the string choice helper function str_plural() to simplify the code.

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
 drivers/accessibility/speakup/kobjects.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/accessibility/speakup/kobjects.c b/drivers/accessibility/speakup/kobjects.c
index 0dfdb6608e02..57139971e997 100644
--- a/drivers/accessibility/speakup/kobjects.c
+++ b/drivers/accessibility/speakup/kobjects.c
@@ -98,7 +98,7 @@ static void report_char_chartab_status(int reset, int received, int used,
 		if (rejected)
 			snprintf(buf + (len - 1), sizeof(buf) - (len - 1),
 				 " with %d reject%s\n",
-				 rejected, rejected > 1 ? "s" : "");
+				 rejected, str_plural(rejected));
 		pr_info("%s", buf);
 	}
 }
@@ -740,7 +740,7 @@ static void report_msg_status(int reset, int received, int used,
 		if (rejected)
 			snprintf(buf + (len - 1), sizeof(buf) - (len - 1),
 				 " with %d reject%s\n",
-				 rejected, rejected > 1 ? "s" : "");
+				 rejected, str_plural(rejected));
 		pr_info("%s", buf);
 	}
 }
-- 
2.34.1


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

* Re: [PATCH] accessibility: Use str_plural() to simplify the code
  2025-08-07  8:59 [PATCH] accessibility: Use str_plural() to simplify the code Xichao Zhao
@ 2025-08-07  9:17 ` Samuel Thibault
  0 siblings, 0 replies; 2+ messages in thread
From: Samuel Thibault @ 2025-08-07  9:17 UTC (permalink / raw)
  To: Xichao Zhao; +Cc: w.d.hubbs, chris, kirk, speakup, linux-kernel

Xichao Zhao, le jeu. 07 août 2025 16:59:30 +0800, a ecrit:
> Use the string choice helper function str_plural() to simplify the code.
> 
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  drivers/accessibility/speakup/kobjects.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/accessibility/speakup/kobjects.c b/drivers/accessibility/speakup/kobjects.c
> index 0dfdb6608e02..57139971e997 100644
> --- a/drivers/accessibility/speakup/kobjects.c
> +++ b/drivers/accessibility/speakup/kobjects.c
> @@ -98,7 +98,7 @@ static void report_char_chartab_status(int reset, int received, int used,
>  		if (rejected)
>  			snprintf(buf + (len - 1), sizeof(buf) - (len - 1),
>  				 " with %d reject%s\n",
> -				 rejected, rejected > 1 ? "s" : "");
> +				 rejected, str_plural(rejected));
>  		pr_info("%s", buf);
>  	}
>  }
> @@ -740,7 +740,7 @@ static void report_msg_status(int reset, int received, int used,
>  		if (rejected)
>  			snprintf(buf + (len - 1), sizeof(buf) - (len - 1),
>  				 " with %d reject%s\n",
> -				 rejected, rejected > 1 ? "s" : "");
> +				 rejected, str_plural(rejected));
>  		pr_info("%s", buf);
>  	}
>  }
> -- 
> 2.34.1

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

end of thread, other threads:[~2025-08-07  9:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-07  8:59 [PATCH] accessibility: Use str_plural() to simplify the code Xichao Zhao
2025-08-07  9:17 ` Samuel Thibault

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.