| 168 | } |
| 169 | |
| 170 | static bool surface_py_string(yyjson_val *value, bool nullable, const char **out) { |
| 171 | *out = NULL; |
| 172 | if (!value) { |
| 173 | return false; |
| 174 | } |
| 175 | if (yyjson_is_null(value)) { |
| 176 | return nullable; |
| 177 | } |
| 178 | const char *text = yyjson_get_str(value); |
| 179 | if (!text || strlen(text) != yyjson_get_len(value)) { |
| 180 | return false; |
| 181 | } |
| 182 | *out = text; |
| 183 | return true; |
| 184 | } |
| 185 | |
| 186 | /* Arrays belong to scratch; strings borrow the immutable JSON document. |
| 187 | * The caller keeps both alive until validation/copy/comparison is finished. */ |
no outgoing calls
no test coverage detected