aboutsummaryrefslogtreecommitdiffstats
path: root/src/args.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/args.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/args.c')
-rw-r--r--src/args.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/args.c b/src/args.c
index b861018..1a4b38c 100644
--- a/src/args.c
+++ b/src/args.c
@@ -480,8 +480,9 @@ display_app (struct tm *t, int numdays, int add_line, const char *fmt_apt,
* days.
*/
static void
-date_arg (char *ddate, int add_line, const char *fmt_apt, const char *fmt_rapt,
- const char *fmt_ev, const char *fmt_rev, regex_t *regex)
+date_arg (const char *ddate, int add_line, const char *fmt_apt,
+ const char *fmt_rapt, const char *fmt_ev, const char *fmt_rev,
+ regex_t *regex)
{
int i;
struct date day;
@@ -544,7 +545,7 @@ date_arg (char *ddate, int add_line, const char *fmt_apt, const char *fmt_rapt,
* Many thanks to Erik Saule for providing this function.
*/
static void
-date_arg_extended (char *startday, char *range, int add_line,
+date_arg_extended (const char *startday, const char *range, int add_line,
const char *fmt_apt, const char *fmt_rapt,
const char *fmt_ev, const char *fmt_rev, regex_t *regex)
{
@@ -633,8 +634,8 @@ parse_args (int argc, char **argv)
const char *fmt_todo = "%p. %m\n";
int tnum = 0, xfmt = 0, non_interactive = 0, multiple_flag = 0, load_data = 0;
- char *ddate = "", *cfile = NULL, *range = NULL, *startday = NULL;
- char *datadir = NULL, *ifile = NULL;
+ const char *ddate = "", *cfile = NULL, *range = NULL, *startday = NULL;
+ const char *datadir = NULL, *ifile = NULL;
regex_t reg, *preg = NULL;
/* Long options only */
@@ -644,7 +645,7 @@ parse_args (int argc, char **argv)
STATUS_OPT = CHAR_MAX + 1
};
- static char *optstr = "ghvnNax::t::d:c:r::s::S:D:i:";
+ static const char *optstr = "ghvnNax::t::d:c:r::s::S:D:i:";
struct option longopts[] = {
{"appointment", no_argument, NULL, 'a'},