Skip to content

Commit 6a196d8

Browse files
committed
code cleanup, comments
1 parent 633e245 commit 6a196d8

File tree

1 file changed

+6
-32
lines changed

1 file changed

+6
-32
lines changed

src/_arraykit.c

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,32 +1468,6 @@ AK_CPL_CurrentAdvance(AK_CodePointLine* cpl)
14681468
}
14691469

14701470
//------------------------------------------------------------------------------
1471-
// Set the CPL field to the characters accumulated in the CPL's buffer. This is only used for field converters that need a char* as an input argument. This has to be dynamically allocated and cleaned up appropriately.
1472-
// static inline char*
1473-
// AK_CPL_current_to_field(AK_CodePointLine* cpl)
1474-
// {
1475-
// // NOTE: we assume this is only called after offset_max is complete, and that this is only called once per CPL; we set it to the maximum size on first usage and then overwrite context on each subsequent usage.
1476-
// if (cpl->field == NULL) {
1477-
// // create a NULL-terminated string; need one more for string terminator
1478-
// cpl->field = (char*)PyMem_Malloc(sizeof(char) * (cpl->offset_max + 1));
1479-
// if (cpl->field == NULL) return (char*)PyErr_NoMemory();
1480-
// }
1481-
// Py_UCS4 *p = cpl->buffer_current_ptr;
1482-
// Py_UCS4 *end = p + cpl->offsets[cpl->offsets_current_index];
1483-
1484-
// // get pointer to field buffer to write to
1485-
// char *t = cpl->field;
1486-
// while (p < end) {
1487-
// if (AK_is_space(*p)) {
1488-
// ++p;
1489-
// continue;
1490-
// }
1491-
// *t++ = (char)*p++;
1492-
// }
1493-
// *t = '\0'; // must be NULL-terminated string
1494-
// return cpl->field;
1495-
// }
1496-
14971471
// This will take any case of "TRUE" as True, while marking everything else as False; this is the same approach taken with genfromtxt when the dtype is given as bool. This will not fail for invalid true or false strings.
14981472
static inline bool
14991473
AK_CPL_current_to_bool(AK_CodePointLine* cpl) {
@@ -2064,7 +2038,7 @@ AK_line_select_keep(
20642038
}
20652039

20662040
//------------------------------------------------------------------------------
2067-
// CodePointGrid Type, New, Destrctor
2041+
// CodePointGrid Type, New, Destructor
20682042

20692043
typedef struct AK_CodePointGrid {
20702044
Py_ssize_t lines_count; // accumulated number of lines
@@ -2463,11 +2437,11 @@ typedef struct AK_DelimitedReader{
24632437
AK_Dialect *dialect;
24642438
AK_DelimitedReaderState state;
24652439
Py_ssize_t field_len;
2466-
Py_ssize_t record_number;
2467-
Py_ssize_t record_iter_number;
2468-
Py_ssize_t field_number;
2440+
Py_ssize_t record_number; // total records loaded
2441+
Py_ssize_t record_iter_number; // records iterated (counting exclusion)
2442+
Py_ssize_t field_number; // field in current record, reset for each record
24692443
int axis;
2470-
Py_ssize_t *axis_pos;
2444+
Py_ssize_t *axis_pos; // points to either record_number or field_number
24712445
} AK_DelimitedReader;
24722446

24732447
// Called once at the close of each field in a line. Returns 0 on success, -1 on failure
@@ -2686,7 +2660,7 @@ AK_DR_ProcessRecord(AK_DelimitedReader *dr,
26862660
return -1;
26872661
case 0:
26882662
Py_DECREF(record);
2689-
return 1; // skip, process more lines
2663+
return 1; // skip, process more records
26902664
}
26912665
// NOTE: record_number should reflect the processed line count, and exlude any skipped lines. The value is initialized to -1 such the first line is number 0
26922666
++dr->record_number;

0 commit comments

Comments
 (0)