Skip to content

Commit 1b3eba0

Browse files
committed
fix: consolidate it even further
1 parent 627df4c commit 1b3eba0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pandas/_libs/src/parser/tokenizer.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)