Skip to contentSkip to conversation

cmd_date: constify

PATCH New Mike Frysinger 2 participants 2 messages Oct 20, 2010 – Nov 28, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd_date: constify

Many strings in this file need not be writable.

---
 common/cmd_date.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
common/cmd_date.c +4 -4
index 50b4240..88c8d85 100644
@@ -31,7 +31,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-const char *weekdays[] = {
+static const char * const weekdays[] = {
 	"Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur",
 };
 
@@ -41,7 +41,7 @@ const char *weekdays[] = {
 #define RELOC(a)	((typeof(a))((unsigned long)(a) + gd->reloc_off))
 #endif
 
-int mk_date (char *, struct rtc_time *);
+int mk_date (const char *, struct rtc_time *);
 
 int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
@@ -106,7 +106,7 @@ int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 /*
  * simple conversion of two-digit string with error checking
  */
-static int cnvrt2 (char *str, int *valp)
+static int cnvrt2 (const char *str, int *valp)
 {
 	int val;
 
@@ -131,7 +131,7 @@ static int cnvrt2 (char *str, int *valp)
  * Some basic checking for valid values is done, but this will not catch
  * all possible error conditions.
  */
-int mk_date (char *datestr, struct rtc_time *tmp)
+int mk_date (const char *datestr, struct rtc_time *tmp)
 {
 	int len, val;
 	char *ptr;
Signature · 1 line
1.7.3.1
#1 lore raw

PATCH 1/1 cmd_date: constify

Dear Mike Frysinger,

Quoted 6 lines · In message <[email protected]> you wrote:

Many strings in this file need not be writable.

---
 common/cmd_date.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

Applied to "next" branch, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
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
"Most people would like to be delivered  from  temptation  but  would
like it to keep in touch."                             - Robert Orben