49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'ext/c_frida/Bus.c', line 49
static VALUE Bus_post(int argc, VALUE *argv, VALUE self)
{
GET_GOBJECT_DATA();
REQUIRE_GOBJECT_HANDLE();
VALUE message, kws, data;
GBytes *gdata = NULL;
rb_scan_args(argc, argv, "1:", &message, &kws);
if (!RB_TYPE_P(message, T_STRING)) {
raise_argerror("message should be a string.");
return (Qnil);
}
if (!NIL_P(kws)) {
data = rb_hash_aref(kws, ID2SYM(rb_intern("data")));
if (!NIL_P(data)) {
if (!RB_TYPE_P(data, T_STRING)) {
raise_argerror("scope must be a string.");
return (Qnil);
}
gdata = g_bytes_new(RSTRING_PTR(data), RSTRING_LEN(data));
}
}
bus_post_proxy_args args = {
.handle = d->handle,
.message = StringValueCStr(message),
.data = gdata
};
CALL_GVL_FREE_WITH_RET(void *dummy, post, &args);
g_bytes_unref(gdata);
return (Qnil);
gerror:
g_bytes_unref(gdata);
raise_rerror(NULL, _gerr);
return (Qnil);
}
|