mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fs: FAT: Cleanup string initializations (char[] instead of char *)
@ 2014-05-17 15:14 Manuel Schölling
  2014-05-17 15:45 ` OGAWA Hirofumi
  0 siblings, 1 reply; 2+ messages in thread
From: Manuel Schölling @ 2014-05-17 15:14 UTC (permalink / raw)
  To: hirofumi; +Cc: linux-kernel, Manuel Schölling

Initializations like 'char *foo = "bar"' will create two variables: a static
string and a pointer (foo) to that static string. Instead 'char foo[] = "bar"'
will declare a single variable and will end up in shorter
assembly (according to Jeff Garzik on the KernelJanitor's TODO list).

Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
---
 fs/fat/inode.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index b3361fe..8b7d00e 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -359,7 +359,7 @@ struct inode *fat_iget(struct super_block *sb, loff_t i_pos)
 
 static int is_exec(unsigned char *extension)
 {
-	unsigned char *exe_extensions = "EXECOMBAT", *walk;
+	unsigned char exe_extensions[] = "EXECOMBAT", *walk;
 
 	for (walk = exe_extensions; *walk; walk += 3)
 		if (!strncmp(extension, walk, 3))
-- 
1.7.10.4


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

end of thread, other threads:[~2014-05-17 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-17 15:14 [PATCH] fs: FAT: Cleanup string initializations (char[] instead of char *) Manuel Schölling
2014-05-17 15:45 ` OGAWA Hirofumi

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

all inboxes | Powered by JetHome®