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

Function gjs_get_string_id

gjs/jsapi-util-string.cpp:413–423  ·  view source on GitHub ↗

* gjs_get_string_id: * @cx: a #JSContext * @id: a jsid that is an object hash key (could be an int or string) * @name_p place to store ASCII string version of key * * If the id is not a string ID, return true and set *name_p to nullptr. * Otherwise, return true and fill in *name_p with ASCII name of id. * * Returns: false on error, otherwise true */

Source from the content-addressed store, hash-verified

411 * Returns: false on error, otherwise true
412 */
413bool gjs_get_string_id(JSContext* cx, jsid id, JS::UniqueChars* name_p) {
414 if (!id.isString()) {
415 name_p->reset();
416 return true;
417 }
418
419 JSLinearString* lstr = id.toLinearString();
420 JS::RootedString s(cx, JS_FORGET_STRING_LINEARNESS(lstr));
421 *name_p = JS_EncodeStringToUTF8(cx, s);
422 return !!*name_p;
423}
424
425/**
426 * gjs_unichar_from_string:

Callers 8

resolve_implMethod · 0.85
param_resolveFunction · 0.85
resolve_namespace_objectFunction · 0.85
resolve_implMethod · 0.85
resolve_implMethod · 0.85
resolve_implMethod · 0.85
resolve_implMethod · 0.85
do_importFunction · 0.85

Calls 1

resetMethod · 0.45

Tested by

no test coverage detected