summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <vva@genie.(none)>2002-11-22 18:35:58 +0400
committerunknown <vva@genie.(none)>2002-11-22 18:35:58 +0400
commited4a4b89cdebaa31560fcbfd0f677e4b59a54123 (patch)
tree2a30ba577983fd03bb27f9a98ad8798c951be2ac
parentda023c7b0a397ad07b2f9af680ae9c61cdd4513b (diff)
downloadmariadb-git-ed4a4b89cdebaa31560fcbfd0f677e4b59a54123.tar.gz
correct some warnings with const char*
-rw-r--r--readline/bind.c8
-rw-r--r--readline/display.c11
-rw-r--r--readline/histexpand.c4
-rw-r--r--readline/history.h4
-rw-r--r--readline/isearch.c4
-rw-r--r--readline/readline.h4
-rw-r--r--readline/rlprivate.h22
-rw-r--r--readline/tcap.h2
-rw-r--r--readline/terminal.c77
-rw-r--r--readline/text.c4
-rw-r--r--readline/tilde.c2
11 files changed, 72 insertions, 70 deletions
diff --git a/readline/bind.c b/readline/bind.c
index 324499acf8f..7e8ca04e0d6 100644
--- a/readline/bind.c
+++ b/readline/bind.c
@@ -1629,17 +1629,17 @@ rl_set_keymap_from_edit_mode ()
}
-char *
+const char *
rl_get_keymap_name_from_edit_mode ()
{
if (rl_editing_mode == emacs_mode)
- return (char*)"emacs";
+ return "emacs";
#if defined (VI_MODE)
else if (rl_editing_mode == vi_mode)
- return (char*)"vi";
+ return "vi";
#endif /* VI_MODE */
else
- return (char*)"nope";
+ return "nope";
}
/* **************************************************************** */
diff --git a/readline/display.c b/readline/display.c
index 82899d04f0c..f393e7e8516 100644
--- a/readline/display.c
+++ b/readline/display.c
@@ -121,7 +121,7 @@ int _rl_suppress_redisplay = 0;
/* The stuff that gets printed out before the actual text of the line.
This is usually pointing to rl_prompt. */
-char *rl_display_prompt = (char *)NULL;
+const char *rl_display_prompt = (char *)NULL;
/* Pseudo-global variables declared here. */
/* The visible cursor position. If you print some text, adjust this. */
@@ -382,7 +382,7 @@ rl_redisplay ()
register char *line;
int c_pos, inv_botlin, lb_botlin, lb_linenum;
int newlines, lpos, temp;
- char *prompt_this_line;
+ const char *prompt_this_line;
#if defined (HANDLE_MULTIBYTE)
wchar_t wc;
size_t wc_bytes;
@@ -395,7 +395,7 @@ rl_redisplay ()
return;
if (!rl_display_prompt)
- rl_display_prompt = (char*)"";
+ rl_display_prompt = "";
if (invisible_line == 0)
{
@@ -1760,7 +1760,7 @@ rl_reset_line_state ()
{
rl_on_new_line ();
- rl_display_prompt = (char*)(rl_prompt ? rl_prompt : "");
+ rl_display_prompt = rl_prompt ? rl_prompt : "";
forced_display = 1;
return 0;
}
@@ -1999,7 +1999,8 @@ static void
redraw_prompt (t)
char *t;
{
- char *oldp, *oldl, *oldlprefix;
+ const char *oldp;
+ char *oldl, *oldlprefix;
int oldlen, oldlast, oldplen, oldninvis;
/* Geez, I should make this a struct. */
diff --git a/readline/histexpand.c b/readline/histexpand.c
index a98067956c2..f01d54c5b1d 100644
--- a/readline/histexpand.c
+++ b/readline/histexpand.c
@@ -85,14 +85,14 @@ char history_comment_char = '\0';
/* The list of characters which inhibit the expansion of text if found
immediately following history_expansion_char. */
-char *history_no_expand_chars = (char*)" \t\n\r=";
+const char *history_no_expand_chars = " \t\n\r=";
/* If set to a non-zero value, single quotes inhibit history expansion.
The default is 0. */
int history_quotes_inhibit_expansion = 0;
/* Used to split words by history_tokenize_internal. */
-char *history_word_delimiters = (char*)HISTORY_WORD_DELIMITERS;
+const char *history_word_delimiters = HISTORY_WORD_DELIMITERS;
/* If set, this points to a function that is called to verify that a
particular history expansion should be performed. */
diff --git a/readline/history.h b/readline/history.h
index 58b5de4655f..afd85104554 100644
--- a/readline/history.h
+++ b/readline/history.h
@@ -225,9 +225,9 @@ extern int history_length;
extern int history_max_entries;
extern char history_expansion_char;
extern char history_subst_char;
-extern char *history_word_delimiters;
+extern const char *history_word_delimiters;
extern char history_comment_char;
-extern char *history_no_expand_chars;
+extern const char *history_no_expand_chars;
extern char *history_search_delimiter_chars;
extern int history_quotes_inhibit_expansion;
diff --git a/readline/isearch.c b/readline/isearch.c
index c0604ce703c..137842a841f 100644
--- a/readline/isearch.c
+++ b/readline/isearch.c
@@ -70,7 +70,7 @@ static char *prev_line_found;
static char *last_isearch_string;
static int last_isearch_string_len;
-static char default_isearch_terminators[] = "\033\012";
+static const char *default_isearch_terminators = "\033\012";
/* Search backwards through the history looking for a string which is typed
interactively. Start with the current line. */
@@ -186,7 +186,7 @@ rl_search_history (direction, invoking_key)
/* The list of characters which terminate the search, but are not
subsequently executed. If the variable isearch-terminators has
been set, we use that value, otherwise we use ESC and C-J. */
- char *isearch_terminators;
+ const char *isearch_terminators;
RL_SETSTATE(RL_STATE_ISEARCH);
orig_point = rl_point;
diff --git a/readline/readline.h b/readline/readline.h
index f11b3d0357c..9425de50aef 100644
--- a/readline/readline.h
+++ b/readline/readline.h
@@ -329,7 +329,7 @@ extern void rl_set_keymap PARAMS((Keymap));
extern Keymap rl_get_keymap PARAMS((void));
/* Undocumented; used internally only. */
extern void rl_set_keymap_from_edit_mode PARAMS((void));
-extern char *rl_get_keymap_name_from_edit_mode PARAMS((void));
+extern const char *rl_get_keymap_name_from_edit_mode PARAMS((void));
/* Functions for manipulating the funmap, which maps command names to functions. */
extern int rl_add_funmap_entry PARAMS((const char *, rl_command_func_t *));
@@ -390,7 +390,7 @@ extern void rl_resize_terminal PARAMS((void));
extern void rl_set_screen_size PARAMS((int, int));
extern void rl_get_screen_size PARAMS((int *, int *));
-extern char *rl_get_termcap PARAMS((const char *));
+extern const char *rl_get_termcap PARAMS((const char *));
/* Functions for character input. */
extern int rl_stuff_char PARAMS((int));
diff --git a/readline/rlprivate.h b/readline/rlprivate.h
index 78bee107dcd..36645fb4a65 100644
--- a/readline/rlprivate.h
+++ b/readline/rlprivate.h
@@ -230,7 +230,7 @@ extern int _rl_page_completions;
extern int _rl_vis_botlin;
extern int _rl_last_c_pos;
extern int _rl_suppress_redisplay;
-extern char *rl_display_prompt;
+extern const char *rl_display_prompt;
/* isearch.c */
extern char *_rl_isearch_terminators;
@@ -261,16 +261,16 @@ extern procenv_t readline_top_level;
/* terminal.c */
extern int _rl_enable_keypad;
extern int _rl_enable_meta;
-extern char *_rl_term_clreol;
-extern char *_rl_term_clrpag;
-extern char *_rl_term_im;
-extern char *_rl_term_ic;
-extern char *_rl_term_ei;
-extern char *_rl_term_DC;
-extern char *_rl_term_up;
-extern char *_rl_term_dc;
-extern char *_rl_term_cr;
-extern char *_rl_term_IC;
+extern const char *_rl_term_clreol;
+extern const char *_rl_term_clrpag;
+extern const char *_rl_term_im;
+extern const char *_rl_term_ic;
+extern const char *_rl_term_ei;
+extern const char *_rl_term_DC;
+extern const char *_rl_term_up;
+extern const char *_rl_term_dc;
+extern const char *_rl_term_cr;
+extern const char *_rl_term_IC;
extern int _rl_screenheight;
extern int _rl_screenwidth;
extern int _rl_screenchars;
diff --git a/readline/tcap.h b/readline/tcap.h
index 58ab894d93e..4606520bf87 100644
--- a/readline/tcap.h
+++ b/readline/tcap.h
@@ -42,7 +42,7 @@
#endif
extern char PC;
-extern char *UP, *BC;
+extern const char *UP, *BC;
extern short ospeed;
diff --git a/readline/terminal.c b/readline/terminal.c
index c6f53e3a500..9ca4d6e43c5 100644
--- a/readline/terminal.c
+++ b/readline/terminal.c
@@ -84,40 +84,41 @@ static int tcap_initialized;
# if defined (__EMX__) || defined (NEED_EXTERN_PC)
extern
# endif /* __EMX__ || NEED_EXTERN_PC */
-char PC, *BC, *UP;
+const char PC;
+const char *BC, *UP;
#endif /* __linux__ */
/* Some strings to control terminal actions. These are output by tputs (). */
-char *_rl_term_clreol;
-char *_rl_term_clrpag;
-char *_rl_term_cr;
-char *_rl_term_backspace;
-char *_rl_term_goto;
-char *_rl_term_pc;
+const char *_rl_term_clreol;
+const char *_rl_term_clrpag;
+const char *_rl_term_cr;
+const char *_rl_term_backspace;
+const char *_rl_term_goto;
+const char *_rl_term_pc;
/* Non-zero if we determine that the terminal can do character insertion. */
int _rl_terminal_can_insert = 0;
/* How to insert characters. */
-char *_rl_term_im;
-char *_rl_term_ei;
-char *_rl_term_ic;
-char *_rl_term_ip;
-char *_rl_term_IC;
+const char *_rl_term_im;
+const char *_rl_term_ei;
+const char *_rl_term_ic;
+const char *_rl_term_ip;
+const char *_rl_term_IC;
/* How to delete characters. */
-char *_rl_term_dc;
-char *_rl_term_DC;
+const char *_rl_term_dc;
+const char *_rl_term_DC;
#if defined (HACK_TERMCAP_MOTION)
char *_rl_term_forward_char;
#endif /* HACK_TERMCAP_MOTION */
/* How to go up a line. */
-char *_rl_term_up;
+const char *_rl_term_up;
/* A visible bell; char if the terminal can be made to flash the screen. */
-static char *_rl_visible_bell;
+static const char *_rl_visible_bell;
/* Non-zero means the terminal can auto-wrap lines. */
int _rl_term_autowrap;
@@ -127,30 +128,30 @@ static int term_has_meta;
/* The sequences to write to turn on and off the meta key, if this
terminal has one. */
-static char *_rl_term_mm;
-static char *_rl_term_mo;
+static const char *_rl_term_mm;
+static const char *_rl_term_mo;
/* The key sequences output by the arrow keys, if this terminal has any. */
-static char *_rl_term_ku;
-static char *_rl_term_kd;
-static char *_rl_term_kr;
-static char *_rl_term_kl;
+static const char *_rl_term_ku;
+static const char *_rl_term_kd;
+static const char *_rl_term_kr;
+static const char *_rl_term_kl;
/* How to initialize and reset the arrow keys, if this terminal has any. */
-static char *_rl_term_ks;
-static char *_rl_term_ke;
+static const char *_rl_term_ks;
+static const char *_rl_term_ke;
/* The key sequences sent by the Home and End keys, if any. */
-static char *_rl_term_kh;
-static char *_rl_term_kH;
-static char *_rl_term_at7; /* @7 */
+static const char *_rl_term_kh;
+static const char *_rl_term_kH;
+static const char *_rl_term_at7; /* @7 */
/* Insert key */
-static char *_rl_term_kI;
+static const char *_rl_term_kI;
/* Cursor control */
-static char *_rl_term_vs; /* very visible */
-static char *_rl_term_ve; /* normal */
+static const char *_rl_term_vs; /* very visible */
+static const char *_rl_term_ve; /* normal */
static void bind_termcap_arrow_keys PARAMS((Keymap));
@@ -296,7 +297,7 @@ rl_resize_terminal ()
struct _tc_string {
const char *tc_var;
- char **tc_value;
+ const char **tc_value;
};
/* This should be kept sorted, just in case we decide to change the
@@ -416,7 +417,7 @@ _rl_init_terminal_io (terminal_name)
/* Everything below here is used by the redisplay code (tputs). */
_rl_screenchars = _rl_screenwidth * _rl_screenheight;
- _rl_term_cr = (char*)"\r";
+ _rl_term_cr = "\r";
_rl_term_im = _rl_term_ei = _rl_term_ic = _rl_term_IC = (char *)NULL;
_rl_term_up = _rl_term_dc = _rl_term_DC = _rl_visible_bell = (char *)NULL;
_rl_term_ku = _rl_term_kd = _rl_term_kl = _rl_term_kr = (char *)NULL;
@@ -433,8 +434,8 @@ _rl_init_terminal_io (terminal_name)
tgoto if _rl_term_IC or _rl_term_DC is defined, but just in case we
change that later... */
PC = '\0';
- BC = _rl_term_backspace = (char*)"\b";
- UP = _rl_term_up;
+ BC = (char*)(_rl_term_backspace = "\b");
+ UP = (char*)_rl_term_up;
return 0;
}
@@ -444,11 +445,11 @@ _rl_init_terminal_io (terminal_name)
/* Set up the variables that the termcap library expects the application
to provide. */
PC = _rl_term_pc ? *_rl_term_pc : 0;
- BC = _rl_term_backspace;
- UP = _rl_term_up;
+ BC = (char*)_rl_term_backspace;
+ UP = (char*)_rl_term_up;
if (!_rl_term_cr)
- _rl_term_cr = (char*)"\r";
+ _rl_term_cr = "\r";
_rl_term_autowrap = tgetflag ("am") && tgetflag ("xn");
@@ -500,7 +501,7 @@ bind_termcap_arrow_keys (map)
_rl_keymap = xkeymap;
}
-char *
+const char *
rl_get_termcap (cap)
const char *cap;
{
diff --git a/readline/text.c b/readline/text.c
index f84fd91344f..81a468fdbda 100644
--- a/readline/text.c
+++ b/readline/text.c
@@ -1132,11 +1132,11 @@ int
rl_insert_comment (count, key)
int count __attribute__((unused)), key;
{
- char *rl_comment_text;
+ const char *rl_comment_text;
int rl_comment_len;
rl_beg_of_line (1, key);
- rl_comment_text = (char*)(_rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT);
+ rl_comment_text = _rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT;
if (rl_explicit_arg == 0)
rl_insert_text (rl_comment_text);
diff --git a/readline/tilde.c b/readline/tilde.c
index 11209903cf8..fab4aab65ad 100644
--- a/readline/tilde.c
+++ b/readline/tilde.c
@@ -190,7 +190,7 @@ tilde_expand (string)
int result_size, result_index;
result_index = result_size = 0;
- if ((result = (char*)strchr(string, '~')))
+ if ((result = strchr(string, '~')))
result = (char *)xmalloc (result_size = (strlen (string) + 16));
else
result = (char *)xmalloc (result_size = (strlen (string) + 1));