Ceiling for a caller-requested node budget. CBM_UI_MAX_RENDER_NODES lowers * (or raises, up to HARD_MAX_NODES) the ceiling for constrained deployments; * without it the full hard ceiling is available to explicit requests. */
| 180 | * (or raises, up to HARD_MAX_NODES) the ceiling for constrained deployments; |
| 181 | * without it the full hard ceiling is available to explicit requests. */ |
| 182 | static int render_node_limit(void) { |
| 183 | const char *raw = cbm_runtime_getenv("CBM_UI_MAX_RENDER_NODES"); |
| 184 | if (!raw || !raw[0]) { |
| 185 | return HARD_MAX_NODES; |
| 186 | } |
| 187 | errno = 0; |
| 188 | char *end = NULL; |
| 189 | long v = strtol(raw, &end, 10); |
| 190 | if (errno != 0 || end == raw || *end != '\0' || v <= 0) { |
| 191 | return HARD_MAX_NODES; |
| 192 | } |
| 193 | if (v > HARD_MAX_NODES) { |
| 194 | return HARD_MAX_NODES; |
| 195 | } |
| 196 | return (int)v; |
| 197 | } |
| 198 | |
| 199 | /* The default is a default, not a ceiling: an explicit request is honored up |
| 200 | * to the (env-adjustable) ceiling; only a missing/invalid request falls back |
no test coverage detected