Skip to content

Commit

Permalink
replace readCString with rcstr
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Tôrres <t0rr3sp3dr0@gmail.com>
  • Loading branch information
t0rr3sp3dr0 committed Mar 17, 2024
1 parent bd0a240 commit d8d559a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@ function getFunc(name, ret_type, args) {
return new NativeFunction(Module.getExportByName(null, name), ret_type, args);
}

// get value type name from xpc_object_t
function getValueTypeName(val) {
var valueType = xpc_get_type(val);
var name = xpc_type_get_name(valueType);
return Memory.readCString(name);
}

// create C string from JavaScript string
function cstr(str) {
return Memory.allocUtf8String(str);
Expand All @@ -66,6 +59,13 @@ function rcstr(cstr) {
return Memory.readCString(cstr);
}

// get value type name from xpc_object_t
function getValueTypeName(val) {
var valueType = xpc_get_type(val);
var name = xpc_type_get_name(valueType);
return rcstr(name);
}

// get C string from XPC string
function getXPCString(val) {
var content = xpc_string_get_string_ptr(val);
Expand Down

0 comments on commit d8d559a

Please sign in to comment.