| 977 | } |
| 978 | |
| 979 | static bool cv2_profile(cv2_context_t *ctx, cv2_span_t fields[4], int index) { |
| 980 | uint64_t id, counters; |
| 981 | cbm_coverage_profile_t *row = &ctx->map->profiles[index]; |
| 982 | if (!cv2_decimal(ctx, fields[0], true, &id)) |
| 983 | return false; |
| 984 | if (id != (uint64_t)index) |
| 985 | return cv2_fail(ctx, CBM_COVERAGE_PARSE_FORMAT); |
| 986 | row->id = index; |
| 987 | if (!cv2_hex64(ctx, fields[2], &row->function_hash) || |
| 988 | !cv2_decimal(ctx, fields[3], true, &counters)) |
| 989 | return false; |
| 990 | if (!counters) |
| 991 | return cv2_fail(ctx, CBM_COVERAGE_PARSE_FORMAT); |
| 992 | row->counter_count = counters; |
| 993 | if (!cv2_name(ctx, fields[1], row)) |
| 994 | return false; |
| 995 | if (index) { |
| 996 | int order; |
| 997 | if (!cv2_profile_compare(ctx, row - 1, row, &order)) |
| 998 | return false; |
| 999 | if (order >= 0) |
| 1000 | return cv2_fail(ctx, CBM_COVERAGE_PARSE_FORMAT); |
| 1001 | } |
| 1002 | return true; |
| 1003 | } |
| 1004 | |
| 1005 | static bool cv2_profiles(cv2_context_t *ctx, cv2_span_t profiles) { |
| 1006 | size_t position = ctx->profile_start; |
no test coverage detected