1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2024-12-08 00:45:29 +01:00

style: fix editorconfig lint

This commit is contained in:
Divlo 2021-09-29 00:10:40 +02:00
parent a6bd36b754
commit 08fd145584
No known key found for this signature in database
GPG Key ID: 6F24DA54DA3967CF
2 changed files with 5 additions and 6 deletions

View File

@ -31,14 +31,13 @@ bool string_is_palindrome(const char* string) {
return is_palindrome; return is_palindrome;
} }
char* string_replace(const char* string, char search_value, char* string_replace(const char* string, char search, char replace) {
char replace_value) {
size_t string_length = strlen(string); size_t string_length = strlen(string);
char* result = malloc(sizeof(char) * (string_length + 1)); char* result = malloc(sizeof(char) * (string_length + 1));
for (size_t index = 0; index < string_length; index++) { for (size_t index = 0; index < string_length; index++) {
bool is_search_value = search_value == string[index]; bool is_search_value = search == string[index];
if (is_search_value) { if (is_search_value) {
character_append(result, replace_value); character_append(result, replace);
} else { } else {
character_append(result, string[index]); character_append(result, string[index]);
} }

View File

@ -30,7 +30,7 @@ char* string_reverse(const char* string);
bool string_is_palindrome(const char* string); bool string_is_palindrome(const char* string);
/** /**
* @brief Replace all the occurrences of search_value into replace_value in * @brief Replace all the occurrences of search value into replace value in
* the string. * the string.
* *
* @param string * @param string
@ -38,6 +38,6 @@ bool string_is_palindrome(const char* string);
* @param replace_value A character containing the text to replace for match. * @param replace_value A character containing the text to replace for match.
* @return char* * @return char*
*/ */
char* string_replace(const char* string, char search_value, char replace_value); char* string_replace(const char* string, char search, char replace);
#endif #endif