Skip to content

Commit 627df4c

Browse files
committed
fix: move remaining_bytes_to_read to the start of loop
1 parent 82dc037 commit 627df4c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

pandas/_libs/src/parser/tokenizer.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,9 +1887,9 @@ static int copy_string_without_char(char output[PROCESSED_WORD_CAPACITY],
18871887
const char *right;
18881888
const char *end_ptr = str + str_len;
18891889
size_t bytes_written = 0;
1890-
size_t remaining_bytes_to_read = str_len;
18911890

1892-
while (remaining_bytes_to_read > 0) {
1891+
while (left < end_ptr) {
1892+
size_t remaining_bytes_to_read = end_ptr - left;
18931893
right = memchr(left, char_to_remove, remaining_bytes_to_read);
18941894

18951895
// If it doesn't find the char to remove, just copy until EOS.
@@ -1905,7 +1905,6 @@ static int copy_string_without_char(char output[PROCESSED_WORD_CAPACITY],
19051905

19061906
// Advance past the removed character if we found it.
19071907
left = right ? right + 1 : end_ptr;
1908-
remaining_bytes_to_read -= right ? chunk_size + 1 : chunk_size;
19091908
}
19101909

19111910
// null terminate

0 commit comments

Comments
 (0)