From eee9ce324a85a4974188b93c6ca6a11020d00c1c Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Wed, 16 Mar 2011 13:26:57 +0000 Subject: [PATCH] ldlinux: Sprinkle const type qualifers MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The following warnings are all caused because we're assigning from const char * to char *. As the strings are never modified, it makes sense to add the const type qualifer instead of casting away const. readconfig.c: In function ‘parse_config_file’: readconfig.c:708:11: warning: assignment discards qualifiers from pointer target type readconfig.c:937:10: warning: assignment discards qualifiers from pointer target type readconfig.c:987:20: warning: assignment discards qualifiers from pointer target type readconfig.c:998:15: warning: assignment discards qualifiers from pointer target type readconfig.c:1004:18: warning: assignment discards qualifiers from pointer target type readconfig.c:1041:11: warning: assignment discards qualifiers from pointer target type Signed-off-by: Matt Fleming --- com32/elflink/ldlinux/config.h | 4 ++-- com32/elflink/ldlinux/readconfig.c | 8 ++++---- core/elflink/core-elf.h | 4 ++-- core/elflink/kernel.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/com32/elflink/ldlinux/config.h b/com32/elflink/ldlinux/config.h index 7765266..37c57da 100644 --- a/com32/elflink/ldlinux/config.h +++ b/com32/elflink/ldlinux/config.h @@ -33,7 +33,7 @@ extern short vkernel; //have we seen any "label" statements? extern short displaycon; //conio.inc extern short nohalt; //idle.inc -extern char *default_cmd; //"default" command line -extern char *onerror; //"onerror" command line +extern const char *default_cmd; //"default" command line +extern const char *onerror; //"onerror" command line #endif /* __CONFIG_H__ */ diff --git a/com32/elflink/ldlinux/readconfig.c b/com32/elflink/ldlinux/readconfig.c index c618dc0..b6cfb1b 100644 --- a/com32/elflink/ldlinux/readconfig.c +++ b/com32/elflink/ldlinux/readconfig.c @@ -59,8 +59,8 @@ short vkernel = 0; //have we seen any "label" statements? short displaycon = 1; //conio.inc short nohalt = 1; //idle.inc -char *default_cmd = NULL; //"default" command line -char *onerror = NULL; //"onerror" command line +const char *default_cmd = NULL; //"default" command line +const char *onerror = NULL; //"onerror" command line /* Empty refstring */ const char *empty_string; @@ -75,7 +75,7 @@ long long totaltimeout = 0; /* Keep track of global default */ static int has_ui = 0; /* DEFAULT only counts if UI is found */ -extern char *globaldefault; +extern const char *globaldefault; static bool menusave = false; /* True if there is any "menu save" */ /* Linked list of all entires, hidden or not; used by unlabel() */ @@ -568,7 +568,7 @@ uint32_t parse_argb(char **p) * same way as if the files had been concatenated together. */ //static const char *append = NULL; -extern char *append; +extern const char *append; //static unsigned int ipappend = 0; unsigned int ipappend = 0; static struct labeldata ld; diff --git a/core/elflink/core-elf.h b/core/elflink/core-elf.h index d13f506..dcca900 100644 --- a/core/elflink/core-elf.h +++ b/core/elflink/core-elf.h @@ -18,9 +18,9 @@ enum kernel_type { KT_CONFIG, /* Configuration file */ }; -extern char *append; +extern const char *append; extern char *ippappend; -extern char *globaldefault; +extern const char *globaldefault; extern short onerrorlen; extern int new_linux_kernel(char *okernel, char *ocmdline); diff --git a/core/elflink/kernel.c b/core/elflink/kernel.c index 6cb3363..3ce2358 100644 --- a/core/elflink/kernel.c +++ b/core/elflink/kernel.c @@ -10,8 +10,8 @@ #include "core.h" #include "core-elf.h" -char *globaldefault = NULL; -char *append = NULL; +const char *globaldefault = NULL; +const char *append = NULL; /* Will be called from readconfig.c */ int new_linux_kernel(char *okernel, char *ocmdline) -- 2.7.4