| 377 | } |
| 378 | |
| 379 | const char *cbm_runtime_getenv(const char *name) { |
| 380 | /* A small per-thread ring supports callers that inspect several inherited |
| 381 | * values together without exposing libc's mutable environment storage. */ |
| 382 | static CBM_TLS char inherited[4][CBM_SZ_4K]; |
| 383 | static CBM_TLS unsigned slot; |
| 384 | const char *value = NULL; |
| 385 | if (environment_resolver && environment_resolver(name, &value)) { |
| 386 | return value; |
| 387 | } |
| 388 | char *buffer = inherited[slot++ % 4U]; |
| 389 | return cbm_native_getenv(name, buffer, CBM_SZ_4K, NULL); |
| 390 | } |
| 391 | |
| 392 | const char *cbm_safe_getenv(const char *name, char *buf, size_t buf_sz, const char *fallback) { |
| 393 | const char *value = NULL; |
no test coverage detected