Skip to content

Commit b5b8f3b

Browse files
committed
rename bytes_read to bytes_written
1 parent 29d74f7 commit b5b8f3b

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

pandas/_libs/src/parser/tokenizer.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,18 +1886,19 @@ static int copy_string_without_char(char output[PROCESSED_WORD_CAPACITY],
18861886
const char *left = str;
18871887
const char *right;
18881888
const char *end_ptr = str + str_len;
1889-
size_t bytes_read = 0;
1889+
size_t bytes_written = 0;
18901890

1891-
while ((right = memchr(left, char_to_remove, str_len - bytes_read)) != NULL) {
1891+
while ((right = memchr(left, char_to_remove, str_len - bytes_written)) !=
1892+
NULL) {
18921893
size_t nbytes = right - left;
18931894

18941895
// check if we have enough space, including the null terminator.
1895-
if (nbytes + bytes_read >= PROCESSED_WORD_CAPACITY) {
1896+
if (nbytes + bytes_written >= PROCESSED_WORD_CAPACITY) {
18961897
return -1;
18971898
}
18981899
// copy block
1899-
memcpy(&output[bytes_read], left, nbytes);
1900-
bytes_read += nbytes;
1900+
memcpy(&output[bytes_written], left, nbytes);
1901+
bytes_written += nbytes;
19011902
left = right + 1;
19021903

19031904
// Exit after processing the entire string
@@ -1909,15 +1910,15 @@ static int copy_string_without_char(char output[PROCESSED_WORD_CAPACITY],
19091910
// copy final chunk that doesn't contain char_to_remove
19101911
if (end_ptr > left) {
19111912
size_t nbytes = end_ptr - left;
1912-
if (nbytes + bytes_read >= PROCESSED_WORD_CAPACITY) {
1913+
if (nbytes + bytes_written >= PROCESSED_WORD_CAPACITY) {
19131914
return -1;
19141915
}
1915-
memcpy(&output[bytes_read], left, nbytes);
1916-
bytes_read += nbytes;
1916+
memcpy(&output[bytes_written], left, nbytes);
1917+
bytes_written += nbytes;
19171918
}
19181919

19191920
// null terminate
1920-
output[bytes_read] = '\0';
1921+
output[bytes_written] = '\0';
19211922
return 0;
19221923
}
19231924

0 commit comments

Comments
 (0)