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:
parent
90c4667e3b
commit
3d307fe341
@ -1172,14 +1172,14 @@ 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) {
|
||||
return found;
|
||||
}
|
||||
|
||||
// autocomplete parameters
|
||||
// autocomplete parameters
|
||||
} else {
|
||||
char* found = _cmd_ac_complete_params(window, input, previous);
|
||||
if (found) {
|
||||
|
12
src/common.c
12
src/common.c
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user