Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace custom macro with stdlib #30061

Merged
merged 2 commits into from
Dec 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions pandas/_libs/src/parser/tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,6 @@ static int parser_buffer_bytes(parser_t *self, size_t nbytes) {

#define END_LINE() END_LINE_STATE(START_RECORD)

#define IS_WHITESPACE(c) ((c == ' ' || c == '\t'))

#define IS_TERMINATOR(c) \
(c == line_terminator)

Expand All @@ -667,7 +665,7 @@ static int parser_buffer_bytes(parser_t *self, size_t nbytes) {
// applied when in a field
#define IS_DELIMITER(c) \
((!self->delim_whitespace && c == self->delimiter) || \
(self->delim_whitespace && IS_WHITESPACE(c)))
(self->delim_whitespace && isblank(c)))

#define _TOKEN_CLEANUP() \
self->stream_len = slen; \
Expand Down Expand Up @@ -818,7 +816,7 @@ int tokenize_bytes(parser_t *self,
self->state = EAT_CRNL_NOP;
break;
} else if (!self->delim_whitespace) {
if (IS_WHITESPACE(c) && c != self->delimiter) {
if (isblank(c) && c != self->delimiter) {
} else { // backtrack
// use i + 1 because buf has been incremented but not i
do {
Expand Down Expand Up @@ -848,7 +846,7 @@ int tokenize_bytes(parser_t *self,
} else if (IS_COMMENT_CHAR(c)) {
self->state = EAT_COMMENT;
break;
} else if (!IS_WHITESPACE(c)) {
} else if (!isblank(c)) {
self->state = START_FIELD;
// fall through to subsequent state
} else {
Expand Down Expand Up @@ -892,7 +890,7 @@ int tokenize_bytes(parser_t *self,
} else if (IS_COMMENT_CHAR(c)) {
self->state = EAT_LINE_COMMENT;
break;
} else if (IS_WHITESPACE(c)) {
} else if (isblank(c)) {
if (self->delim_whitespace) {
if (self->skip_empty_lines) {
self->state = WHITESPACE_LINE;
Expand Down