commit f717f98d071f89481f53d4086130cdc81086d5a2
parent d3c8f09d17b52917aa0e837e86beeff7560c4583
Author: Chris Allegretta <chrisa@asty.org>
Date: Thu, 13 Feb 2003 22:25:01 +0000
Revert const char * strings as it gives warnings with -Wwrite-strings
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1467 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
5 files changed, 22 insertions(+), 25 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -13,9 +13,6 @@ CVS code
__ identifier (Jordi).
- Memory leak fixes for files.c:do_insertfile(),do_browser(),
nano.c:do_spell(), and search.c:do_replace() (David Benbennick).
- - Change various const char *s to char *s because Irix curses
- waddnstr() complains about const char's, I imagine this is a
- common System V curses issue.
- Remove do_preserve_msg, as using -p still gives Pico-style
string behavior, so an annoying message every invocation is
probably unneeded (all cheer).
diff --git a/global.c b/global.c
@@ -165,9 +165,9 @@ int length_of_list(const shortcut *s)
}
/* Initialize a struct *without* our lovely braces =( */
-void sc_init_one(shortcut **shortcutage, int key, char *desc,
+void sc_init_one(shortcut **shortcutage, int key, const char *desc,
#ifndef DISABLE_HELP
- char *help,
+ const char *help,
#endif
int alt, int misc1, int misc2, int view, int (*func) (void))
{
@@ -318,7 +318,7 @@ void free_shortcutage(shortcut **shortcutage)
void shortcut_init(int unjustify)
{
#ifndef DISABLE_HELP
- char *nano_help_msg = "", *nano_writeout_msg = "", *nano_exit_msg =
+ const char *nano_help_msg = "", *nano_writeout_msg = "", *nano_exit_msg =
"", *nano_goto_msg = "", *nano_justify_msg =
"", *nano_replace_msg = "", *nano_insert_msg =
"", *nano_whereis_msg = "", *nano_prevpage_msg =
@@ -339,11 +339,11 @@ void shortcut_init(int unjustify)
"", *nano_backup_msg = "", *nano_editstr_msg = "";
#ifdef ENABLE_MULTIBUFFER
- char *nano_openprev_msg = "", *nano_opennext_msg =
+ const char *nano_openprev_msg = "", *nano_opennext_msg =
"", *nano_multibuffer_msg = "";
#endif
#ifdef HAVE_REGEX_H
- char *nano_regexp_msg = "", *nano_bracket_msg = "";
+ const char *nano_regexp_msg = "", *nano_bracket_msg = "";
#endif
nano_help_msg = _("Invoke the help menu");
diff --git a/nano.h b/nano.h
@@ -150,9 +150,9 @@ typedef struct shortcut {
int misc2;
int viewok; /* is this function legal in view mode? */
int (*func) (void); /* Function to call when we catch this key */
- char *desc; /* Description, e.g. "Page Up" */
+ const char *desc; /* Description, e.g. "Page Up" */
#ifndef DISABLE_HELP
- char *help; /* Help file entry text */
+ const char *help; /* Help file entry text */
#endif
struct shortcut *next;
} shortcut;
diff --git a/proto.h b/proto.h
@@ -201,9 +201,9 @@ char *do_browse_from(const char *inpath);
/* Public functions in global.c */
int length_of_list(const shortcut *s);
-void sc_init_one(shortcut **shortcutage, int key, char *desc,
+void sc_init_one(shortcut **shortcutage, int key, const char *desc,
#ifndef DISABLE_HELP
- char *help,
+ const char *help,
#endif
int alt, int misc1, int misc2, int view, int (*func) (void));
#ifndef NANO_SMALL
@@ -429,8 +429,8 @@ void blank_edit(void);
void blank_statusbar(void);
void blank_statusbar_refresh(void);
void check_statblank(void);
-void nanoget_repaint(char *buf, char *inputbuf, int x);
-int nanogetstr(int allowtabs, char *buf, const char *def,
+void nanoget_repaint(const char *buf, const char *inputbuf, int x);
+int nanogetstr(int allowtabs, const char *buf, const char *def,
#ifndef NANO_SMALL
historyheadtype *history_list,
#endif
@@ -440,9 +440,9 @@ int nanogetstr(int allowtabs, char *buf, const char *def,
#endif
);
void set_modified(void);
-void titlebar(char *path);
+void titlebar(const char *path);
void bottombars(const shortcut *s);
-void onekey(char *keystroke, char *desc, int len);
+void onekey(const char *keystroke, const char *desc, int len);
#ifndef NDEBUG
int check_linenumbers(const filestruct *fileptr);
#endif
diff --git a/winio.c b/winio.c
@@ -166,7 +166,7 @@ void check_statblank(void)
*
* Note that we must turn on A_REVERSE here, since do_help() turns it
* off! */
-void nanoget_repaint(char *buf, char *inputbuf, int x)
+void nanoget_repaint(const char *buf, const char *inputbuf, int x)
{
int len = strlen(buf) + 2;
int wid = COLS - len;
@@ -186,7 +186,7 @@ void nanoget_repaint(char *buf, char *inputbuf, int x)
/* Get the input from the kb; this should only be called from
* statusq(). */
-int nanogetstr(int allowtabs, char *buf, const char *def,
+int nanogetstr(int allowtabs, const char *buf, const char *def,
#ifndef NANO_SMALL
historyheadtype *history_list,
#endif
@@ -509,10 +509,10 @@ void set_modified(void)
}
}
-void titlebar(char *path)
+void titlebar(const char *path)
{
int namelen, space;
- char *what = path;
+ const char *what = path;
if (path == NULL)
what = filename;
@@ -613,7 +613,7 @@ void bottombars(const shortcut *s)
* keystroke is e.g. "^G" and desc is e.g. "Get Help".
* We are careful to write exactly len characters, even if len is
* very small and keystroke and desc are long. */
-void onekey(char *keystroke, char *desc, int len)
+void onekey(const char *keystroke, const char *desc, int len)
{
wattron(bottomwin, A_REVERSE);
@@ -1515,7 +1515,7 @@ int do_help(void)
bottombars(help_list);
do {
- char *ptr = help_text;
+ const char *ptr = help_text;
switch (kbinput) {
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
@@ -1724,10 +1724,10 @@ void do_credits(void)
{
int i, j = 0, k, place = 0, start_x;
- char *what;
- char *xlcredits[XLCREDIT_LEN];
+ const char *what;
+ const char *xlcredits[XLCREDIT_LEN];
- char *credits[CREDIT_LEN] = {
+ const char *credits[CREDIT_LEN] = {
"0", /* "The nano text editor" */
"1", /* "version" */
VERSION,