diff --git a/include/common.h b/include/common.h index a67acef..94ade22 100644 --- a/include/common.h +++ b/include/common.h @@ -29,7 +29,7 @@ typedef enum { VAR_RW, VAR_RC, VAR_RO } var_perms; */ typedef struct _var { - char *name; + const char *name; var_type type; var_perms perms; void *ptr; @@ -118,7 +118,7 @@ typedef struct _conditional_fmt_field */ typedef struct _funcmap { - char *name; + const char *name; void (*function)(); int argn; prog_mode mode; diff --git a/include/formats.h b/include/formats.h index 2904fbe..2acc1fb 100644 --- a/include/formats.h +++ b/include/formats.h @@ -9,7 +9,7 @@ #include "common.h" -fmt_field *compile_format_string(char *); +fmt_field *compile_format_string(const char *); char *eval_format(fmt_field *, task *); void compile_formats(); void free_formats(); diff --git a/include/tasknc.h b/include/tasknc.h index a937399..06c59d4 100644 --- a/include/tasknc.h +++ b/include/tasknc.h @@ -47,7 +47,7 @@ void print_version(void); void set_curses_mode(const ncurses_mode); char *str_trim(char *); int umvaddstr(WINDOW *, const int, const int, const char *, ...) __attribute__((format(printf,4,5))); -int umvaddstr_align(WINDOW *, const int, char *); +int umvaddstr_align(WINDOW *, const int, const char *); void wipe_screen(WINDOW *, const short, const short); void wipe_window(WINDOW *); diff --git a/src/command.c b/src/command.c index 5e867fd..7c8c53d 100644 --- a/src/command.c +++ b/src/command.c @@ -26,7 +26,8 @@ static void source_fp(const FILE *); void handle_command(char *cmdstr) /* {{{ */ { /* accept a command string, determine what action to take, and execute */ - char *command, *args, *modestr, *pos; + char *command, *args, *pos; + const char *modestr; funcmap *fmap; prog_mode mode; int ret = 0; diff --git a/src/formats.c b/src/formats.c index 0e1b82f..de6c91c 100644 --- a/src/formats.c +++ b/src/formats.c @@ -22,7 +22,7 @@ static fmt_field *buffer_field(char *, int); static char *eval_conditional(conditional_fmt_field *, task *); static char *field_to_str(fmt_field *, bool *, task *); static void free_format(fmt_field *); -static conditional_fmt_field *parse_conditional(char **); +static conditional_fmt_field *parse_conditional(const char **); char *append_buffer(char *buffer, const char append, int *bufferlen) /* {{{ */ { @@ -78,7 +78,7 @@ void compile_formats() /* {{{ */ cfg.formats.view_compiled = compile_format_string(cfg.formats.view); } /* }}} */ -fmt_field *compile_format_string(char *fmt) /* {{{ */ +fmt_field *compile_format_string(const char *fmt) /* {{{ */ { /* compile a given format string */ fmt_field *head = NULL, *this, *last = NULL; @@ -403,7 +403,7 @@ void free_formats() /* {{{ */ free_format(cfg.formats.task_compiled); } /* }}} */ -conditional_fmt_field *parse_conditional(char **str) /* {{{ */ +conditional_fmt_field *parse_conditional(const char **str) /* {{{ */ { /* parse a conditional struct from a string at a position */ conditional_fmt_field *this = calloc(1, sizeof(conditional_fmt_field)); diff --git a/src/keys.c b/src/keys.c index 85a2e28..a4f6fef 100644 --- a/src/keys.c +++ b/src/keys.c @@ -25,7 +25,7 @@ struct keymap { int value; - char *name; + const char *name; }; /* keymaps {{{ */ @@ -180,7 +180,8 @@ void add_keybind(const int key, void *function, char *arg, const prog_mode mode) */ keybind *this_bind, *new; int n = 0; - char *modestr, *name; + const char *modestr; + char *name; /* create new bind */ new = calloc(1, sizeof(keybind)); @@ -224,7 +225,8 @@ void handle_keypress(const int c, const prog_mode mode) /* {{{ */ * mode - the mode the key was pressed during */ keybind *this_bind; - char *modestr, *keyname; + const char *modestr; + char *keyname; bool match = false; /* exit if timeout occurred */ diff --git a/src/pager.c b/src/pager.c index 2be7adf..fe74093 100644 --- a/src/pager.c +++ b/src/pager.c @@ -23,7 +23,7 @@ #include "tasknc.h" /* local functions */ -static void pager_window(line *, const bool, int, char *); +static void pager_window(line *, const bool, int, const char *); /* global variables */ int offset, height, linecount; @@ -49,7 +49,8 @@ void help_window() /* {{{ */ /* display a help window */ line *head, *cur, *last; keybind *this; - char *modestr, *keyname; + const char *modestr; + char *keyname; static bool help_running = false; /* check for existing help window */ @@ -190,7 +191,7 @@ void pager_command(const char *cmdstr, const char *title, const bool fullscreen, free_lines(head); } /* }}} */ -void pager_window(line *head, const bool fullscreen, int nlines, char *title) /* {{{ */ +void pager_window(line *head, const bool fullscreen, int nlines, const char *title) /* {{{ */ { /** * page through a linked list of lines diff --git a/src/tasklist.c b/src/tasklist.c index 3a5c323..9e6b30c 100644 --- a/src/tasklist.c +++ b/src/tasklist.c @@ -325,7 +325,8 @@ void key_tasklist_toggle_started() /* {{{ */ bool started; time_t now; task *cur = get_task_by_position(selline); - char *cmdstr, *action, *actionpast, *reply; + char *cmdstr, *reply; + const char *action, *actionpast; FILE *cmdout; int ret; diff --git a/src/tasknc.c b/src/tasknc.c index d0c83bd..3f4b25c 100644 --- a/src/tasknc.c +++ b/src/tasknc.c @@ -742,7 +742,7 @@ int umvaddstr(WINDOW *win, const int y, const int x, const char *format, ...) /* return r; } /* }}} */ -int umvaddstr_align(WINDOW *win, const int y, char *str) /* {{{ */ +int umvaddstr_align(WINDOW *win, const int y, const char *str) /* {{{ */ { /* evaluate an aligned string * win - the window to print the string in diff --git a/src/test.c b/src/test.c index 61d6475..b249929 100644 --- a/src/test.c +++ b/src/test.c @@ -79,7 +79,8 @@ void test_compile_fmt() /* {{{ */ { /* test compiling a format to a series of fields */ fmt_field *fmts; - char *eval, *teststr; + char *eval; + const char *teststr; teststr = "first $date $-8program_version $4program_name $10program_author ++?$search_string?SEARCH??++ ++?$active_filter??NO?++ second"; fmts = compile_format_string(teststr); @@ -100,7 +101,7 @@ void test_compile_fmt() /* {{{ */ void test_result(const char *testname, const bool passed) /* {{{ */ { /* print a colored result for a test */ - char *color, *msg; + const char *color, *msg; /* determine color and message */ if (passed)