head, `levels` times '(', core, `levels` times ')', tail. *core_at receives * the byte offset of core. */
| 11447 | /* head, `levels` times '(', core, `levels` times ')', tail. *core_at receives |
| 11448 | * the byte offset of core. */ |
| 11449 | static char *build_nested_source(const char *head, const char *core, const char *tail, int levels, |
| 11450 | uint32_t *core_at) { |
| 11451 | size_t head_len = strlen(head); |
| 11452 | size_t core_len = strlen(core); |
| 11453 | size_t tail_len = strlen(tail); |
| 11454 | char *src = malloc(head_len + core_len + tail_len + 2 * (size_t)levels + 1); |
| 11455 | if (!src) { |
| 11456 | return NULL; |
| 11457 | } |
| 11458 | char *w = src; |
| 11459 | memcpy(w, head, head_len); |
| 11460 | w += head_len; |
| 11461 | memset(w, '(', (size_t)levels); |
| 11462 | w += levels; |
| 11463 | *core_at = (uint32_t)(w - src); |
| 11464 | memcpy(w, core, core_len); |
| 11465 | w += core_len; |
| 11466 | memset(w, ')', (size_t)levels); |
| 11467 | w += levels; |
| 11468 | memcpy(w, tail, tail_len + 1); |
| 11469 | return src; |
| 11470 | } |
| 11471 | |
| 11472 | /* `$x = ((...((f))...))(...);` — a first-class callable whose callee sits under |
| 11473 | * DEEP_NEST_LEVELS parentheses. PHP, because its first-class callable syntax |
no outgoing calls
no test coverage detected