public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] image: constify lookup tables
@ 2010-10-20 11:17 Mike Frysinger
  2010-11-28 21:02 ` Wolfgang Denk
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2010-10-20 11:17 UTC (permalink / raw)
  To: u-boot

These are pure lookup tables -- no need to be writable.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 common/image.c  |   14 +++++++-------
 include/image.h |    4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/common/image.c b/common/image.c
index 385464d..0005fc5 100644
--- a/common/image.c
+++ b/common/image.c
@@ -74,7 +74,7 @@ static const image_header_t* image_get_ramdisk (ulong rd_addr, uint8_t arch,
 #include <image.h>
 #endif /* !USE_HOSTCC*/
 
-static table_entry_t uimage_arch[] = {
+static const table_entry_t uimage_arch[] = {
 	{	IH_ARCH_INVALID,	NULL,		"Invalid ARCH",	},
 	{	IH_ARCH_ALPHA,		"alpha",	"Alpha",	},
 	{	IH_ARCH_ARM,		"arm",		"ARM",		},
@@ -96,7 +96,7 @@ static table_entry_t uimage_arch[] = {
 	{	-1,			"",		"",		},
 };
 
-static table_entry_t uimage_os[] = {
+static const table_entry_t uimage_os[] = {
 	{	IH_OS_INVALID,	NULL,		"Invalid OS",		},
 	{	IH_OS_LINUX,	"linux",	"Linux",		},
 #if defined(CONFIG_LYNXKDI) || defined(USE_HOSTCC)
@@ -129,7 +129,7 @@ static table_entry_t uimage_os[] = {
 	{	-1,		"",		"",			},
 };
 
-static table_entry_t uimage_type[] = {
+static const table_entry_t uimage_type[] = {
 	{	IH_TYPE_INVALID,    NULL,	  "Invalid Image",	},
 	{	IH_TYPE_FILESYSTEM, "filesystem", "Filesystem Image",	},
 	{	IH_TYPE_FIRMWARE,   "firmware",	  "Firmware",		},
@@ -144,7 +144,7 @@ static table_entry_t uimage_type[] = {
 	{	-1,		    "",		  "",			},
 };
 
-static table_entry_t uimage_comp[] = {
+static const table_entry_t uimage_comp[] = {
 	{	IH_COMP_NONE,	"none",		"uncompressed",		},
 	{	IH_COMP_BZIP2,	"bzip2",	"bzip2 compressed",	},
 	{	IH_COMP_GZIP,	"gzip",		"gzip compressed",	},
@@ -516,7 +516,7 @@ static void genimg_print_time (time_t timestamp)
  *     long entry name if translation succeeds
  *     msg otherwise
  */
-char *get_table_entry_name (table_entry_t *table, char *msg, int id)
+char *get_table_entry_name(const table_entry_t *table, char *msg, int id)
 {
 	for (; table->id >= 0; ++table) {
 		if (table->id == id)
@@ -563,10 +563,10 @@ const char *genimg_get_comp_name (uint8_t comp)
  *     entry id if translation succeeds
  *     -1 otherwise
  */
-int get_table_entry_id (table_entry_t *table,
+int get_table_entry_id(const table_entry_t *table,
 		const char *table_name, const char *name)
 {
-	table_entry_t *t;
+	const table_entry_t *t;
 #ifdef USE_HOSTCC
 	int first = 1;
 
diff --git a/include/image.h b/include/image.h
index 49d6280..005e0d2 100644
--- a/include/image.h
+++ b/include/image.h
@@ -300,14 +300,14 @@ typedef struct table_entry {
  * entry that matches the given short name. If a matching entry is
  * found, it's id is returned to the caller.
  */
-int get_table_entry_id (table_entry_t *table,
+int get_table_entry_id(const table_entry_t *table,
 		const char *table_name, const char *name);
 /*
  * get_table_entry_name() scans the translation table trying to find
  * an entry that matches the given id. If a matching entry is found,
  * its long name is returned to the caller.
  */
-char *get_table_entry_name (table_entry_t *table, char *msg, int id);
+char *get_table_entry_name(const table_entry_t *table, char *msg, int id);
 
 const char *genimg_get_os_name (uint8_t os);
 const char *genimg_get_arch_name (uint8_t arch);
-- 
1.7.3.1

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

* [U-Boot] [PATCH] image: constify lookup tables
  2010-10-20 11:17 [U-Boot] [PATCH] image: constify lookup tables Mike Frysinger
@ 2010-11-28 21:02 ` Wolfgang Denk
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2010-11-28 21:02 UTC (permalink / raw)
  To: u-boot

Dear Mike Frysinger,

In message <1287573459-6658-1-git-send-email-vapier@gentoo.org> you wrote:
> These are pure lookup tables -- no need to be writable.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  common/image.c  |   14 +++++++-------
>  include/image.h |    4 ++--
>  2 files changed, 9 insertions(+), 9 deletions(-)

Applied to "next" branch, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
KLB is an acronym for `Known Lazy Bastard', aka non-FAQ  reader,  aka
person  who  would  rather  make  someone  take their time to explain
something basic than look it up in a  FAQ.
         -- Tom Christiansen in <6aq547$mnr$2@csnews.cs.colorado.edu>

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

end of thread, other threads:[~2010-11-28 21:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-20 11:17 [U-Boot] [PATCH] image: constify lookup tables Mike Frysinger
2010-11-28 21:02 ` Wolfgang Denk

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