mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ntfs: Cleanup string initializations (char[] instead of char *)
@ 2014-05-17 12:25 Manuel Schölling
  2014-05-17 17:26 ` Anton Altaparmakov
  0 siblings, 1 reply; 2+ messages in thread
From: Manuel Schölling @ 2014-05-17 12:25 UTC (permalink / raw)
  To: anton; +Cc: linux-ntfs-dev, 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 allocate only a 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/ntfs/inode.c |    2 +-
 fs/ntfs/super.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index f47af5e..3975798 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -2368,7 +2368,7 @@ int ntfs_truncate(struct inode *vi)
 	ntfs_attr_search_ctx *ctx;
 	MFT_RECORD *m;
 	ATTR_RECORD *a;
-	const char *te = "  Leaving file length out of sync with i_size.";
+	const char te[] = "  Leaving file length out of sync with i_size.";
 	int err, mp_size, size_change, alloc_change;
 	u32 attr_len;
 
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 9de2491..eb2c195 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -676,7 +676,7 @@ not_ntfs:
 static struct buffer_head *read_ntfs_boot_sector(struct super_block *sb,
 		const int silent)
 {
-	const char *read_err_str = "Unable to read %s boot sector.";
+	const char read_err_str[] = "Unable to read %s boot sector.";
 	struct buffer_head *bh_primary, *bh_backup;
 	sector_t nr_blocks = NTFS_SB(sb)->nr_blocks;
 
-- 
1.7.10.4


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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-17 12:25 [PATCH] ntfs: Cleanup string initializations (char[] instead of char *) Manuel Schölling
2014-05-17 17:26 ` Anton Altaparmakov

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®