* Fill in value_p with a JS array, converted from a C array stored as a pointer * in array_value, with its length stored in array_length_value. */
| 199 | * in array_value, with its length stored in array_length_value. |
| 200 | */ |
| 201 | GJS_JSAPI_RETURN_CONVENTION |
| 202 | static bool gjs_value_from_array_and_length_values( |
| 203 | JSContext* cx, JS::MutableHandleValue value_p, |
| 204 | const GI::TypeInfo& array_type_info, const GValue* array_value, |
| 205 | Maybe<std::pair<const GI::ArgInfo, const GI::TypeInfo>> array_length_info, |
| 206 | const GValue* array_length_value, bool no_copy, |
| 207 | bool is_introspected_signal) { |
| 208 | JS::RootedValue array_length{cx}; |
| 209 | |
| 210 | // NOLINTBEGIN(bugprone-assert-side-effect,bugprone-reserved-identifier) |
| 211 | // G_VALUE_HOLDS* macros mess up these two checks |
| 212 | g_assert(G_VALUE_HOLDS_POINTER(array_value)); |
| 213 | g_assert(G_VALUE_HOLDS_INT(array_length_value)); |
| 214 | // NOLINTEND(bugprone-assert-side-effect,bugprone-reserved-identifier) |
| 215 | |
| 216 | if (!gjs_value_from_g_value_internal(cx, &array_length, array_length_value, |
| 217 | no_copy, is_introspected_signal, |
| 218 | std::move(array_length_info))) |
| 219 | return false; |
| 220 | |
| 221 | GIArgument array_arg; |
| 222 | gjs_arg_set(&array_arg, Gjs::gvalue_get<void*>(array_value)); |
| 223 | |
| 224 | return gjs_value_from_explicit_array( |
| 225 | cx, value_p, array_type_info, &array_arg, array_length.toInt32(), |
| 226 | no_copy ? GI_TRANSFER_NOTHING : GI_TRANSFER_EVERYTHING); |
| 227 | } |
| 228 | |
| 229 | // FIXME(3v1n0): Move into closure.cpp one day... |
| 230 | void Gjs::Closure::marshal(GValue* return_value, unsigned n_param_values, |
no test coverage detected