common: make 'lenient_strcmp' arguments const

Prevents build failures when calling the function with 'const char *'
arguments.
This is also more accurate since the function is not expected to modify
the args.
This commit is contained in:
Paul Riou 2020-12-03 19:17:42 +00:00 committed by Simon Ser
parent 32b93ef6ea
commit 4583feee59
2 changed files with 2 additions and 2 deletions

View File

@ -64,7 +64,7 @@ char *lenient_strncat(char *dest, const char *src, size_t len) {
}
// strcmp that also handles null pointers.
int lenient_strcmp(char *a, char *b) {
int lenient_strcmp(const char *a, const char *b) {
if (a == b) {
return 0;
} else if (!a) {

View File

@ -12,7 +12,7 @@ char *lenient_strcat(char *dest, const char *src);
char *lenient_strncat(char *dest, const char *src, size_t len);
// strcmp that also handles null pointers.
int lenient_strcmp(char *a, char *b);
int lenient_strcmp(const char *a, const char *b);
// Simply split a string with delims, free with `list_free_items_and_destroy`
list_t *split_string(const char *str, const char *delims);