File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -680,17 +680,11 @@ char *findinclude(const char *pattern) {
680680}
681681
682682static inline
683- void trim_trailing_ws (char * str , size_t len ) {
683+ void trim_trailing_ws (char * str , size_t len ) {
684+ char * end = str + len ;
684685
685- /* Jump to end of string */
686- char * end = str ;
687- end += len ;
688-
689- /* While character is space and not NULL.
690- * Checking for NULL is required otherwise 'isspace' will produce undefined
691- behaviour when encountering a nonstandard character. */
692- while ((end != NULL ) && isspace (end )) {
693- /* Move backwards */
686+ while (end > str
687+ && isspace (* end )) {
694688 -- end ;
695689 }
696690 * end = '\0' ;
@@ -753,6 +747,9 @@ int findinit(const char *pattern_) {
753747
754748 /* Trim trailing whitespace */
755749 trim_trailing_ws (pattern , pattlen );
750+ if (pattern [0 ] == '\0' ) {
751+ return NOTSYMBOL ;
752+ }
756753
757754 /* Make sure pattern is lowercased. Curses
758755 * mode gets this right all on its own, but at least -L mode
You can’t perform that action at this time.
0 commit comments