Thread (3 messages) 3 messages, 3 authors, 2021-11-30

Re: [PATCH] rbd: make const pointer speaces a static const array

From: Joe Perches <joe@perches.com>
Date: 2021-11-30 06:33:29
Also in: ceph-devel, kernel-janitors, lkml

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.
[]
quoted hunk ↗ jump to hunk
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
[]
quoted hunk ↗ jump to hunk
@@ -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.

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help