From: Ralph Corderoy Date: Sun, 23 Oct 2016 11:08:31 +0000 (+0100) Subject: Alter HasSuffixC()'s char * to be const. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/ef1ba39e8dae81091b6c3e73e72825ef6edea3c6?hp=14665143f973d5dbcdab34de439bdd37a56d0e5f Alter HasSuffixC()'s char * to be const. --- diff --git a/h/utils.h b/h/utils.h index 47ae59f0..c8384b39 100644 --- a/h/utils.h +++ b/h/utils.h @@ -64,7 +64,7 @@ char *rfind_str (const char [], size_t, const char *); char *nmh_strcasestr (const char *, const char *); bool HasPrefix(const char *s, const char *prefix); -bool HasSuffixC(char *s, int c); +bool HasSuffixC(const char *s, int c); void TrimSuffixC(char *s, int c); void ToLower(char *s); void ToUpper(char *s); diff --git a/sbr/utils.c b/sbr/utils.c index a6f0e111..06835d2b 100644 --- a/sbr/utils.c +++ b/sbr/utils.c @@ -372,7 +372,7 @@ bool HasPrefix(const char *s, const char *prefix) /* HasSuffixC returns true if non-NULL string s ends with a c before the * terminating NUL. */ -bool HasSuffixC(char *s, int c) +bool HasSuffixC(const char *s, int c) { return *s && s[strlen(s) - 1] == c; }