linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rbd: make const pointer speaces a static const array
@ 2021-11-27 17:21 Colin Ian King
  2021-11-29 12:07 ` Jeff Layton
  2021-11-30  6:33 ` Joe Perches
  0 siblings, 2 replies; 3+ messages in thread
From: Colin Ian King @ 2021-11-27 17:21 UTC (permalink / raw)
  To: Ilya Dryomov, Dongsheng Yang, Jens Axboe, ceph-devel, linux-block
  Cc: kernel-janitors, linux-kernel

Don't populate the const array spaces on the stack but make it static
const and make the pointer an array to remove a dereference. Shrinks
object code a little too.  Also clean up intent, currently it is spaces
and should be a tab.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/block/rbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 8f140da1efe3..de7ede6aa95a 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -6189,7 +6189,7 @@ static inline size_t next_token(const char **buf)
         * These are the characters that produce nonzero for
         * isspace() in the "C" and "POSIX" locales.
         */
-        const char *spaces = " \f\n\r\t\v";
+	static const char spaces[] = " \f\n\r\t\v";
 
         *buf += strspn(*buf, spaces);	/* Find start of token */
 
-- 
2.33.1


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

* Re: [PATCH] rbd: make const pointer speaces a static const array
  2021-11-27 17:21 [PATCH] rbd: make const pointer speaces a static const array Colin Ian King
@ 2021-11-29 12:07 ` Jeff Layton
  2021-11-30  6:33 ` Joe Perches
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2021-11-29 12:07 UTC (permalink / raw)
  To: Colin Ian King, Ilya Dryomov, Dongsheng Yang, Jens Axboe,
	ceph-devel, linux-block
  Cc: kernel-janitors, linux-kernel

On Sat, 2021-11-27 at 17:21 +0000, Colin Ian King wrote:
> Don't populate the const array spaces on the stack but make it static
> const and make the pointer an array to remove a dereference. Shrinks
> object code a little too.  Also clean up intent, currently it is spaces
> and should be a tab.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  drivers/block/rbd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 8f140da1efe3..de7ede6aa95a 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -6189,7 +6189,7 @@ static inline size_t next_token(const char **buf)
>          * These are the characters that produce nonzero for
>          * isspace() in the "C" and "POSIX" locales.
>          */
> -        const char *spaces = " \f\n\r\t\v";
> +	static const char spaces[] = " \f\n\r\t\v";
>  
>          *buf += strspn(*buf, spaces);	/* Find start of token */
>  

Thanks, Colin. Merged into our "testing" branch. It should make v5.17.
-- 
Jeff Layton <jlayton@kernel.org>

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

* Re: [PATCH] rbd: make const pointer speaces a static const array
  2021-11-27 17:21 [PATCH] rbd: make const pointer speaces a static const array Colin Ian King
  2021-11-29 12:07 ` Jeff Layton
@ 2021-11-30  6:33 ` Joe Perches
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2021-11-30  6:33 UTC (permalink / raw)
  To: Colin Ian King, Ilya Dryomov, Dongsheng Yang, Jens Axboe,
	ceph-devel, linux-block
  Cc: kernel-janitors, linux-kernel

On Sat, 2021-11-27 at 17:21 +0000, Colin Ian King wrote:
> Don't populate the const array spaces on the stack but make it static
> const and make the pointer an array to remove a dereference. Shrinks
> object code a little too.  Also clean up intent, currently it is spaces
> and should be a tab.
[]
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
[]
> @@ -6189,7 +6189,7 @@ static inline size_t next_token(const char **buf)
>          * These are the characters that produce nonzero for
>          * isspace() in the "C" and "POSIX" locales.
>          */
> -        const char *spaces = " \f\n\r\t\v";
> +	static const char spaces[] = " \f\n\r\t\v";
>  
>          *buf += strspn(*buf, spaces);	/* Find start of token */
>  

perhaps

	while (isspace(**buf))
		(*buf)++;

and not have or use spaces at all.



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

end of thread, other threads:[~2021-11-30  6:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-27 17:21 [PATCH] rbd: make const pointer speaces a static const array Colin Ian King
2021-11-29 12:07 ` Jeff Layton
2021-11-30  6:33 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).