Commit d4b81bb9 authored by Dmitry Frank's avatar Dmitry Frank Committed by rojer

Refactor v7_to_number -> v7_get_double and others

We wanted to avoid `to` since it implies some kind of conversion, but
these functions merely return underlying C entity.

Public API changes:

- `v7_to_number()` -> `v7_get_double()`
- `v7_to_boolean()` -> `v7_get_bool()`
- `v7_to_cstring()` -> `v7_get_cstring()`
- `v7_get_string_data()` -> `v7_get_string()`
- `v7_to_foreign()` -> `v7_get_ptr()`

Private API changes:

- `v7_to_pointer()` -> `get_ptr()`
- `v7_to_generic_object()` -> `get_generic_object_struct()`
- `v7_to_object()` -> `get_object_struct()`
- `to_js_function()` -> `get_js_function_struct()`
- `to_cfunction()` -> `get_cfunction_ptr()`

PUBLISHED_FROM=036ac18d442c1128106292ad3e7a818b177eec6a
parent 23122b32
......@@ -2269,11 +2269,11 @@ void mg_mgr_init(struct mg_mgr *m, void *user_data) {
static enum v7_err mg_send_js(struct v7 *v7, v7_val_t *res) {
v7_val_t arg0 = v7_arg(v7, 0);
v7_val_t arg1 = v7_arg(v7, 1);
struct mg_connection *c = (struct mg_connection *) v7_to_foreign(arg0);
struct mg_connection *c = (struct mg_connection *) v7_get_ptr(arg0);
size_t len = 0;
if (v7_is_string(arg1)) {
const char *data = v7_get_string_data(v7, &arg1, &len);
const char *data = v7_get_string(v7, &arg1, &len);
mg_send(c, data, len);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment