diff options
author | Michael Vetter <jubalh@iodoru.org> | 2020-11-02 18:52:25 +0100 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2020-11-02 18:52:25 +0100 |
commit | 3d307fe3418919b42bc00a7e171f0c3050c8d8e6 (patch) | |
tree | e838f9b70d66b3f5382e8150bdf60d6b2bba2b4b /src | |
parent | 90c4667e3b60be0c78ebefc933219167db4a6169 (diff) | |
download | profani-tty-3d307fe3418919b42bc00a7e171f0c3050c8d8e6.tar.gz |
Get rid of str_contains()
We can use strchr() here.
Diffstat (limited to 'src')
-rw-r--r-- | src/command/cmd_ac.c | 4 | ||||
-rw-r--r-- | src/common.c | 12 | ||||
-rw-r--r-- | src/common.h | 1 |
3 files changed, 2 insertions, 15 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index 52535f23..12b2ae9d 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -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) { diff --git a/src/common.c b/src/common.c index d339a37a..f05bc3ba 100644 --- a/src/common.c +++ b/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) { diff --git a/src/common.h b/src/common.h index 588abd10..13332f7a 100644 --- a/src/common.h +++ b/src/common.h @@ -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); |