146 if (fc != 3) { |
146 if (fc != 3) { |
147 fprintf(stderr, "Syntax error in line %zu.\n", i); |
147 fprintf(stderr, "Syntax error in line %zu.\n", i); |
148 cxMempoolDestroy(pool); |
148 cxMempoolDestroy(pool); |
149 return 1; |
149 return 1; |
150 } |
150 } |
151 CSVData* data = cxMalloc(pool->allocator, sizeof(CSVData)); |
151 CSVData data; |
152 data->column_a = fields[0]; |
152 data.column_a = fields[0]; |
153 data->column_b = fields[1]; |
153 data.column_b = fields[1]; |
154 data->column_c = fields[2]; |
154 data.column_c = fields[2]; |
155 cxListAdd(datalist, data); |
155 cxListAdd(datalist, &data); |
156 } |
156 } |
157 |
157 |
158 // iterate through the list and output the data |
158 // iterate through the list and output the data |
159 CxIterator iter = cxListIterator(datalist); |
159 CxIterator iter = cxListIterator(datalist); |
160 cx_foreach(CSVData*, data, iter) { |
160 cx_foreach(CSVData*, data, iter) { |