lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 07 Dec 2009 17:47:13 -0800
From:	Joe Perches <joe@...ches.com>
To:	Anton Altaparmakov <aia21@....ac.uk>
Cc:	John Daiker <daikerjohn@...il.com>,
	kernel-janitors@...r.kernel.org, aia21@...tab.net,
	linux-ntfs-dev@...ts.sourceforge.net,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] NTFS: Change string pointers to string constants.

On Tue, 2009-12-08 at 00:57 +0000, Anton Altaparmakov wrote:
> Can you please explain the rational for making this change?

Perhaps it's not worth much, but it saves a pointer reference.

$ cat pointer.c
#include <string.h>
#include <stdio.h>

int main (int argc, char** argv)
{
	static const char *foo = "abcdefg";
	printf("%s\n", foo);
	return 0;
}

$ gcc -c pointer.c
$ size pointer.o
   text	   data	    bss	    dec	    hex	filename
     37	      4	      0	     41	     29	pointer.o

$ cat reference.c
#include <string.h>
#include <stdio.h>

int main (int argc, char** argv)
{
static const char foo[] = "abcdefg";
printf("%s\n", foo);
return 0;
}

$ gcc -c reference.c
$ size reference.o
   text    data     bss     dec     hex filename
     36       0       0      36      24 reference.o



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ