Trim grep expression before processing it. (#4227)
This commit is contained in:
parent
766886d706
commit
f0435d94cc
3 changed files with 8 additions and 6 deletions
|
|
@ -433,11 +433,13 @@ RZ_API char *rz_cons_grep_strip(char *cmd, const char *quotestr) {
|
|||
return ptr;
|
||||
}
|
||||
|
||||
RZ_API void rz_cons_grep_process(char *grep) {
|
||||
if (grep) {
|
||||
parse_grep_expression(grep);
|
||||
free(grep);
|
||||
RZ_API void rz_cons_grep_process(RZ_OWN char *grep) {
|
||||
if (!grep) {
|
||||
return;
|
||||
}
|
||||
rz_str_trim_tail(grep);
|
||||
parse_grep_expression(grep);
|
||||
free(grep);
|
||||
}
|
||||
|
||||
static int cmp(const void *a, const void *b, void *user) {
|
||||
|
|
|
|||
|
|
@ -1023,7 +1023,7 @@ RZ_API int rz_cons_get_buffer_len(void);
|
|||
RZ_API void rz_cons_grep_help(void);
|
||||
RZ_API void rz_cons_grep_parsecmd(char *cmd, const char *quotestr);
|
||||
RZ_API char *rz_cons_grep_strip(char *cmd, const char *quotestr);
|
||||
RZ_API void rz_cons_grep_process(char *grep);
|
||||
RZ_API void rz_cons_grep_process(RZ_OWN char *grep);
|
||||
RZ_API int rz_cons_grep_line(char *buf, int len); // must be static
|
||||
RZ_API void rz_cons_grepbuf(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ RZ_API const char *rz_str_trim_head_wp(RZ_NONNULL const char *str) {
|
|||
|
||||
/**
|
||||
* \brief Removes whitespace characters (space, tab, newline etc.)
|
||||
* from the end of a string.
|
||||
* from the beginning of a string.
|
||||
* The string is changed in place.
|
||||
*
|
||||
* \param str The string to trim.
|
||||
|
|
|
|||
Loading…
Reference in a new issue