MCPcopy Create free account
hub / github.com/GNOME/gjs / new_for_c_struct

Method new_for_c_struct

gi/struct.cpp:134–141  ·  view source on GitHub ↗

* StructInstance::new_for_c_struct: * * Creates a new StructInstance JS object from a C boxed struct pointer. * * There are two overloads of this method; the NoCopy overload will simply take * the passed-in pointer but not own it, while the normal method will take a * reference, or if the boxed type can be directly allocated, copy the memory. */

Source from the content-addressed store, hash-verified

132 * reference, or if the boxed type can be directly allocated, copy the memory.
133 */
134JSObject* StructInstance::new_for_c_struct(JSContext* cx,
135 const GI::StructInfo& info,
136 void* gboxed) {
137 JS::RootedObject obj{cx, new_for_c_struct_impl(cx, info, gboxed)};
138 if (!obj || !define_extra_error_properties(cx, obj))
139 return nullptr;
140 return obj;
141}
142
143JSObject* StructInstance::new_for_c_struct(JSContext* cx,
144 const GI::StructInfo& info,

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected