The seam rejects an actual sample string allocation in yyjson's pool, * independently of when that pool needs another backing allocation. */
| 6362 | /* The seam rejects an actual sample string allocation in yyjson's pool, |
| 6363 | * independently of when that pool needs another backing allocation. */ |
| 6364 | static yyjson_mut_val *doc_links_sample_string(yyjson_mut_doc *doc, const char *source, |
| 6365 | size_t length) { |
| 6366 | if (!doc || !source) { |
| 6367 | return NULL; |
| 6368 | } |
| 6369 | #ifdef CBM_ENABLE_TEST_SEAMS |
| 6370 | int remaining = |
| 6371 | atomic_load_explicit(&mcp_doc_links_sample_alloc_countdown, memory_order_relaxed); |
| 6372 | while (remaining >= 0) { |
| 6373 | int next = remaining == 0 ? CBM_NOT_FOUND : remaining - 1; |
| 6374 | if (atomic_compare_exchange_weak_explicit(&mcp_doc_links_sample_alloc_countdown, &remaining, |
| 6375 | next, memory_order_relaxed, |
| 6376 | memory_order_relaxed)) { |
| 6377 | if (remaining == 0) { |
| 6378 | atomic_store_explicit(&mcp_doc_links_sample_alloc_failed, true, |
| 6379 | memory_order_relaxed); |
| 6380 | return NULL; |
| 6381 | } |
| 6382 | break; |
| 6383 | } |
| 6384 | } |
| 6385 | #endif |
| 6386 | return yyjson_mut_strncpy(doc, source, length); |
| 6387 | } |
| 6388 | |
| 6389 | typedef struct { |
| 6390 | char text[CBM_DOC_LINK_PREVIEW_LONG_BYTES + 1]; |
no outgoing calls
no test coverage detected