summaryrefslogtreecommitdiffstats
path: root/src/custom.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-05-08 20:24:48 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2012-05-08 21:50:05 +0200
commit6da787a5cc94d1b20d0730c18905ff3b93201874 (patch)
treeef11c9e2704e9006d11b7edf31e0ab1afb56a603 /src/custom.c
parenta20f36c5deae91805d936c6f7a726cf9c78ad70d (diff)
downloadcalcurse-6da787a5cc94d1b20d0730c18905ff3b93201874.tar.gz
calcurse-6da787a5cc94d1b20d0730c18905ff3b93201874.zip
Declare several parameters/variables constant
Add the "const" keyword to parameters and variables that are never modified. Most of these were spotted by "-Wwrite-strings". We cast the second parameter to execvp() explicitly as it expects a "char *const[]" where it should expect a "const char *const[]" (according to the documentation, this is due to compatibility reasons). This should be changed once we come up with a better solution. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/custom.c')
-rw-r--r--src/custom.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/custom.c b/src/custom.c
index e347850..960837d 100644
--- a/src/custom.c
+++ b/src/custom.c
@@ -157,7 +157,7 @@ display_layout_config (struct window *lwin, int mark, int cursor)
#define MARK 88
#define LAYOUTH 5
#define LAYOUTW 9
- char *box = "[ ]";
+ const char *box = "[ ]";
const int BOXSIZ = strlen (box);
const int NBCOLS = NBLAYOUTS / LAYOUTSPERCOL;
const int COLSIZ = LAYOUTW + BOXSIZ + 1;
@@ -167,7 +167,7 @@ display_layout_config (struct window *lwin, int mark, int cursor)
const int YOFST = (lwin->h - LAYOUTSPERCOL * (YSPC + LAYOUTH)) / 2;
enum {YPOS, XPOS, NBPOS};
int pos[NBLAYOUTS][NBPOS];
- char *layouts[LAYOUTH][NBLAYOUTS] = {
+ const char *layouts[LAYOUTH][NBLAYOUTS] = {
{"+---+---+", "+---+---+", "+---+---+", "+---+---+", "+---+---+", "+---+---+", "+---+---+", "+---+---+"},
{"| | c |", "| | t |", "| c | |", "| t | |", "| | c |", "| | a |", "| c | |", "| a | |"},
{"| a +---+", "| a +---+", "+---+ a |", "|---+ a |", "| t +---+", "| t +---+", "+---+ t |", "+---+ t |"},
@@ -434,8 +434,8 @@ display_color_config (struct window *cwin, int *mark_fore, int *mark_back,
const char *fore_txt = _("Foreground");
const char *back_txt = _("Background");
const char *default_txt = _("(terminal's default)");
- char *bar = " ";
- char *box = "[ ]";
+ const char *bar = " ";
+ const char *box = "[ ]";
const unsigned Y = 3;
const unsigned XOFST = 5;
const unsigned YSPC = (cwin->h - 8) / (NBUSERCOLORS + 1);
@@ -869,7 +869,7 @@ custom_general_config (void)
static void
-print_key_incolor (WINDOW *win, char *option, int pos_y, int pos_x)
+print_key_incolor (WINDOW *win, const char *option, int pos_y, int pos_x)
{
const int color = ATTR_HIGHEST;
@@ -907,7 +907,7 @@ print_keys_bindings (WINDOW *win, int selected_row, int selected_elm, int yoff)
{
if (action == selected_row)
{
- char *key;
+ const char *key;
int pos;
pos = KEYPOS;
@@ -959,7 +959,7 @@ custom_keys_config (void)
struct scrollwin kwin;
int selrow, selelm, firstrow, lastrow, nbrowelm, nbdisplayed;
int keyval, used, not_recognized;
- char *keystr;
+ const char *keystr;
WINDOW *grabwin;
const int LINESPERKEY = 2;
const int LABELLINES = 3;