Every property buffer is owned by a table entry. Account for the new and * old buffers simultaneously until copying has finished and the old one is * released; neither a replacement nor an unknown value retains history. */
| 704 | * old buffers simultaneously until copying has finished and the old one is |
| 705 | * released; neither a replacement nor an unknown value retains history. */ |
| 706 | static char *value_alloc(msb_eval_t *ev, size_t n) { |
| 707 | bool fail = n > SIZE_MAX - ev->value_bytes; |
| 708 | #if defined(CBM_ENABLE_TEST_SEAMS) && CBM_ENABLE_TEST_SEAMS |
| 709 | fail = fail || msb_fail_value_alloc(); |
| 710 | #endif |
| 711 | if (fail) { |
| 712 | ev->oom = true; |
| 713 | return NULL; |
| 714 | } |
| 715 | char *p = (char *)cbm_alloc(CBM_MEM_CLASS_OTHER, n); |
| 716 | if (!p) { |
| 717 | ev->oom = true; |
| 718 | return NULL; |
| 719 | } |
| 720 | ev->value_bytes += n; |
| 721 | #if defined(CBM_ENABLE_TEST_SEAMS) && CBM_ENABLE_TEST_SEAMS |
| 722 | atomic_fetch_add_explicit(&msb_value_live_counter, n, memory_order_relaxed); |
| 723 | #endif |
| 724 | ev_peak(ev); |
| 725 | return p; |
| 726 | } |
| 727 | |
| 728 | static void value_clear(msb_eval_t *ev, msb_prop_t *p) { |
| 729 | if (p->value) { |
no test coverage detected