| 99 | } |
| 100 | |
| 101 | static cbm_ignore_checked_status_t gi_parse(cbm_ignore_checked_t *owner, const void *bytes, |
| 102 | size_t length, |
| 103 | const cbm_ignore_checked_control_t *control, |
| 104 | unsigned fault, cbm_ignore_checked_parse_result_t *out, |
| 105 | cbm_ignore_checked_error_t *error) { |
| 106 | if (out) { |
| 107 | *out = (cbm_ignore_checked_parse_result_t){0}; |
| 108 | } |
| 109 | gi_error(error, CBM_IGNORE_CHECKED_OK, CBM_IGNORE_CAP_NONE, SIZE_MAX); |
| 110 | if (!owner || (!bytes && length) || !control || !control->deadline_ms || !out || |
| 111 | fault > GI_FAULT_PATTERN) { |
| 112 | gi_error(error, CBM_IGNORE_CHECKED_INVALID, CBM_IGNORE_CAP_NONE, SIZE_MAX); |
| 113 | return CBM_IGNORE_CHECKED_INVALID; |
| 114 | } |
| 115 | gi_guard_t guard; |
| 116 | if (!gi_begin(owner, control, &guard) || !gi_bytes(&guard, length)) { |
| 117 | return gi_finish(owner, error); |
| 118 | } |
| 119 | gi_parse_t parse = {.guard = &guard, .bytes = bytes, .length = length, .fault = fault}; |
| 120 | if (gi_parse_pass(&parse) && gi_parse_storage(&parse) && gi_parse_pass(&parse) && |
| 121 | gi_poll(&guard)) { |
| 122 | out->program = parse.program; |
| 123 | out->pattern_count = parse.count; |
| 124 | } |
| 125 | return gi_finish(owner, error); |
| 126 | } |
| 127 | |
| 128 | cbm_ignore_checked_status_t cbm_ignore_checked_parse(cbm_ignore_checked_t *owner, const void *bytes, |
| 129 | size_t length, |
no test coverage detected