| 207 | : ValueDescWriter(pool, /*values_capacity=*/2 + num_rows * num_cols) {} |
| 208 | |
| 209 | void PushValue(ParsedValueDesc v) { |
| 210 | DCHECK_LT(values_size_, values_capacity_); |
| 211 | values_[values_size_] = v; |
| 212 | // We must take care not to write past the buffer's end if the line being |
| 213 | // parsed has more than `num_cols` columns. The obvious solution of setting |
| 214 | // an error status hurts too much on benchmarks, which is why we instead |
| 215 | // cap `values_size_` to stay inside the buffer. |
| 216 | // |
| 217 | // Not setting an error immediately is not a problem since the `num_cols` |
| 218 | // mismatch is detected later in ParseLine. |
| 219 | // |
| 220 | // Note that we want `values_size_` to reflect the number of written values |
| 221 | // in the nominal case, which is why we choose a slightly larger `values_capacity_`. |
| 222 | values_size_ += (values_size_ != values_capacity_ - 1); |
| 223 | } |
| 224 | }; |
| 225 | |
| 226 | } // namespace |
no outgoing calls
no test coverage detected