Skip to content

Commit 0985cf3

Browse files
committed
Remove debugging code; fix type cast
1 parent 669d99b commit 0985cf3

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

pandas/_libs/src/parser/tokenizer.c

+4-12
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,7 @@ static void *grow_buffer(void *buffer, size_t length, size_t *capacity,
7676

7777
// Can we fit potentially nbytes tokens (+ null terminators) in the stream?
7878
while ((length + space >= cap) && (newbuffer != NULL)) {
79-
if (cap < 1024 * 1024 * 1024) {
80-
cap = cap ? cap << 1 : 2;
81-
} else {
82-
cap *= 2;
83-
}
79+
cap = cap ? cap << 1 : 2;
8480
buffer = newbuffer;
8581
newbuffer = safe_realloc(newbuffer, elsize * cap);
8682
}
@@ -457,7 +453,7 @@ static int end_line(parser_t *self) {
457453
return 0;
458454
}
459455

460-
if (!(self->lines <= (unsigned long) self->header_end + 1) &&
456+
if (!(self->lines <= (int64_t) self->header_end + 1) &&
461457
(self->expected_fields < 0 && fields > ex_fields) && !(self->usecols)) {
462458
// increment file line count
463459
self->file_lines++;
@@ -492,7 +488,7 @@ static int end_line(parser_t *self) {
492488
}
493489
} else {
494490
// missing trailing delimiters
495-
if ((self->lines >= (unsigned long) self->header_end + 1) &&
491+
if ((self->lines >= (int64_t) self->header_end + 1) &&
496492
fields < ex_fields) {
497493
// might overrun the buffer when closing fields
498494
if (make_stream_space(self, ex_fields - fields) < 0) {
@@ -1299,11 +1295,7 @@ int parser_trim_buffers(parser_t *self) {
12991295
}
13001296

13011297
/* trim line_start, line_fields */
1302-
if (new_cap < 1024 * 1024 * 1024) {
1303-
new_cap = _next_pow2(self->lines) + 1;
1304-
} else {
1305-
new_cap *= 2;
1306-
}
1298+
new_cap = _next_pow2(self->lines) + 1;
13071299
if (new_cap < self->lines_cap) {
13081300
TRACE(("parser_trim_buffers: new_cap < self->lines_cap\n"));
13091301
newptr = safe_realloc((void *)self->line_start,

0 commit comments

Comments
 (0)