From 50bde4b5c3830a00d06d47de2f76d87ceda0a2e8 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 8 Dec 2024 21:36:54 +0100 Subject: [PATCH] Constify Signed-off-by: Joachim Wiberg --- src/complete.c | 6 +++--- src/editline.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/complete.c b/src/complete.c index 6a65e86..4bd0d07 100644 --- a/src/complete.c +++ b/src/complete.c @@ -40,7 +40,7 @@ static int compare(const void *p1, const void *p2) /* Fill in *avp with an array of names that match file, up to its length. * Ignore . and .. . */ -static int FindMatches(char *dir, char *file, char ***avp) +static int FindMatches(const char *dir, const char *file, char ***avp) { char **av; char **word; @@ -128,7 +128,7 @@ static int FindMatches(char *dir, char *file, char ***avp) /* Split a pathname into allocated directory and trailing filename parts. */ static int SplitPath(const char *path, char **dirpart, char **filepart) { - static char DOT[] = "."; + static const char DOT[] = "."; char *dpart; char *fpart; @@ -287,7 +287,7 @@ char *rl_filename_completion_function(const char *text, int state) /* Similar to el_find_word(), but used by GNU Readline API */ static char *rl_find_token(size_t *len) { - char *ptr; + const char *ptr; int pos; for (pos = rl_point; pos < rl_end; pos++) { diff --git a/src/editline.c b/src/editline.c index 670d726..5fd690b 100644 --- a/src/editline.c +++ b/src/editline.c @@ -211,7 +211,7 @@ static void tty_show(unsigned char c) } } -static void tty_string(char *p) +static void tty_string(const char *p) { int i = rl_point + prompt_len + 1; @@ -1282,7 +1282,7 @@ static char *read_redirected(void) int size = MEM_INC; char *p; char *line; - char *end; + const char *end; p = line = malloc(sizeof(char) * size); if (!p)