The search_code json row layout is column-ordered; find a cell by its * declared column name rather than by a fixed index. */
| 11432 | /* The search_code json row layout is column-ordered; find a cell by its |
| 11433 | * declared column name rather than by a fixed index. */ |
| 11434 | static yyjson_val *sc_json_cell(yyjson_val *root, yyjson_val *row, const char *column) { |
| 11435 | yyjson_val *cols = yyjson_obj_get(root, "cols"); |
| 11436 | size_t n = cols ? yyjson_arr_size(cols) : 0; |
| 11437 | for (size_t i = 0; i < n; i++) { |
| 11438 | const char *name = yyjson_get_str(yyjson_arr_get(cols, i)); |
| 11439 | if (name && strcmp(name, column) == 0) { |
| 11440 | return yyjson_arr_get(row, i); |
| 11441 | } |
| 11442 | } |
| 11443 | return NULL; |
| 11444 | } |
| 11445 | |
| 11446 | /* Regression guard: search_code full results must preserve valid UTF-8 source. */ |
| 11447 | static bool is_valid_json_response(const char *json); |