1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Get rid of str_contains()

We can use strchr() here.
This commit is contained in:
Michael Vetter 2020-11-02 18:52:25 +01:00
parent 90c4667e3b
commit 3d307fe341
3 changed files with 2 additions and 15 deletions

View File

@ -1172,7 +1172,7 @@ char*
cmd_ac_complete(ProfWin* window, const char* const input, gboolean previous)
{
// autocomplete command
if ((strncmp(input, "/", 1) == 0) && (!str_contains(input, strlen(input), ' '))) {
if ((strncmp(input, "/", 1) == 0) && (!strchr(input, ' '))) {
char* found = NULL;
found = autocomplete_complete(commands_ac, input, TRUE, previous);
if (found) {

View File

@ -163,18 +163,6 @@ str_replace(const char* string, const char* substr,
return newstr;
}
int
str_contains(const char str[], int size, char ch)
{
int i;
for (i = 0; i < size; i++) {
if (str[i] == ch)
return 1;
}
return 0;
}
gboolean
strtoi_range(char* str, int* saveptr, int min, int max, char** err_msg)
{

View File

@ -84,7 +84,6 @@ gboolean create_dir(char* name);
gboolean mkdir_recursive(const char* dir);
gboolean copy_file(const char* const src, const char* const target, const gboolean overwrite_existing);
char* str_replace(const char* string, const char* substr, const char* replacement);
int str_contains(const char str[], int size, char ch);
gboolean strtoi_range(char* str, int* saveptr, int min, int max, char** err_msg);
int utf8_display_len(const char* const str);