File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -1892,8 +1892,12 @@ static int copy_string_without_char(char output[PROCESSED_WORD_CAPACITY],
18921892 size_t remaining_bytes_to_read = end_ptr - left ;
18931893 right = memchr (left , char_to_remove , remaining_bytes_to_read );
18941894
1895- // If it doesn't find the char to remove, just copy until EOS.
1896- size_t chunk_size = right ? right - left : end_ptr - left ;
1895+ if (!right ) {
1896+ // If it doesn't find the char to remove, just copy until EOS.
1897+ right = end_ptr ;
1898+ }
1899+
1900+ size_t chunk_size = right - left ;
18971901
18981902 // check if we have enough space, including the null terminator.
18991903 if (chunk_size + bytes_written >= PROCESSED_WORD_CAPACITY ) {
@@ -1904,7 +1908,7 @@ static int copy_string_without_char(char output[PROCESSED_WORD_CAPACITY],
19041908 bytes_written += chunk_size ;
19051909
19061910 // Advance past the removed character if we found it.
1907- left = right ? right + 1 : end_ptr ;
1911+ left = right + 1 ;
19081912 }
19091913
19101914 // null terminate
You can’t perform that action at this time.
0 commit comments